comp.lang.ada
 help / color / mirror / Atom feed
* Creating a win32 DLL witn mingw
@ 2009-07-13 18:22 Lucretia
  2009-07-13 19:35 ` Lucretia9
  0 siblings, 1 reply; 2+ messages in thread
From: Lucretia @ 2009-07-13 18:22 UTC (permalink / 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Creating a win32 DLL witn mingw
  2009-07-13 18:22 Creating a win32 DLL witn mingw Lucretia
@ 2009-07-13 19:35 ` Lucretia9
  0 siblings, 0 replies; 2+ messages in thread
From: Lucretia9 @ 2009-07-13 19:35 UTC (permalink / raw)


I tried the source with gnat-gpl-2009 on win32 and it works fine, so
for some reason the fsf version of gnatmake can't build dll's.

Luke.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-13 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-13 18:22 Creating a win32 DLL witn mingw Lucretia
2009-07-13 19:35 ` Lucretia9

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox