From: Lucretia <Lucretia9000@yahoo.co.uk>
Subject: Creating a win32 DLL witn mingw
Date: Mon, 13 Jul 2009 11:22:26 -0700 (PDT)
Date: 2009-07-13T11:22:26-07:00 [thread overview]
Message-ID: <3eb4cbff-372c-43ff-a526-f2a663574920@m18g2000vbi.googlegroups.com> (raw)
Hi,
I've installed the latested mingw and the gcc-4.4.0 binaries from
their page. I've got a project which just creates a simple shared lib
with 1 function, works fine under Linux, but won't build under Win32
giving the following warning:
mylib_build.gpr:16:25: warning: libraries are not supported on this
platform
The source is:
package Mylib is
type Item is private;
type Item_Access is access all Item;
function Create(A : Integer := 0; B : Boolean := True) return
Item_Access;
private
type Item is
record
A : Integer;
B : Boolean;
end record;
end Mylib;
package body Mylib is
function Create(A : Integer := 0; B : Boolean := True) return
Item_Access is
begin
return new Item'(A, B);
end Create;
end Mylib;
project Mylib_Build is
Major := "1";
Minor := "0";
Rev := "0";
type Lib_Type is ("static", "dynamic");
type Build_Type is ("release", "debug");
type Platform_Type is ("linux", "win32");
Lib : Lib_Type := external("LIB", "dynamic");
Build : Build_Type := external("BUILD", "debug");
Platform : Platform_Type := external("PLATFORM", "linux");
for Source_Dirs use ("./source", "./lib/adainclude");
for Object_Dir use "./objects";
for Library_Name use "mylib";
for Library_Dir use "./lib";
for Library_Kind use Lib;
case Lib is
when "static" =>
case Platform is
when "linux" =>
for Library_Version use "libmylib" & "-" & Major & "."
& Minor & "." & Rev & ".a";
when "win32" =>
for Library_Version use "mylib" & "-" & Major & "." &
Minor & "." & Rev & ".lib";
end case;
when "dynamic" =>
case Platform is
when "linux" =>
for Library_Version use "libmylib" & ".so." & Major &
"." & Minor & "." & Rev;
when "win32" =>
for Library_Version use "mylib" & "-" & Major & "." &
Minor & "." & Rev & ".dll";
end case;
end case;
package Compiler is
case Build is
when "debug" =>
for Default_Switches("Ada") use
("-gnat95",
"-gnata",
"-gnato", "-fstack-check", -- For RM compliance
"-gnatE",
"-ggdb");
when "release" =>
for Default_Switches("Ada") use
("-gnat95",
"-O2",
"-gnato", "-fstack-check"); -- For RM compliance
end case;
end Compiler;
end Mylib_Build;
And the directory structure is like this:
$ ls -lR
-rw-r--r-- 1 laguest laguest 110 2009-07-13 18:13 makefile
drwxr-xr-x 5 laguest laguest 4096 2009-07-13 18:16 mylib
drwxr-xr-x 2 laguest laguest 4096 2009-07-13 19:20 objects
-rw-r--r-- 1 laguest laguest 248 2009-07-13 18:19 testlib.adb
-rw-r--r-- 1 laguest laguest 966 2009-07-13 18:02 testlib.gpr
./mylib:
drwxr-xr-x 4 laguest laguest 4096 2009-07-13 19:20 lib
-rw-r--r-- 1 laguest laguest 131 2009-07-13 18:14 makefile
-rw-r--r-- 1 laguest laguest 1754 2009-07-13 18:09 mylib_build.gpr
-rw-r--r-- 1 laguest laguest 238 2009-07-13 18:16 mylib.gpr
drwxr-xr-x 2 laguest laguest 4096 2009-07-13 19:20 objects
drwxr-xr-x 2 laguest laguest 4096 2009-07-13 18:18 source
./mylib/lib:
drwxr-xr-x 2 laguest laguest 4096 2009-07-13 17:46 adainclude
drwxr-xr-x 2 laguest laguest 4096 2009-07-13 19:20 adalib
./mylib/lib/adainclude:
-rw-r--r-- 1 laguest laguest 315 2009-07-13 17:33 mylib.ads
./mylib/lib/adalib:
./mylib/objects:
./mylib/source:
-rw-r--r-- 1 laguest laguest 404 2009-07-13 18:18 mylib.adb
./objects:
Thanks,
Luke.
next reply other threads:[~2009-07-13 18:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 18:22 Lucretia [this message]
2009-07-13 19:35 ` Creating a win32 DLL witn mingw Lucretia9
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox