comp.lang.ada
 help / color / mirror / Atom feed
* Building DLL with GNAT to be used with non-Ada application on Windows : some doubts
@ 2012-03-28 13:05 Jérôme Haguet
  2012-03-29  8:00 ` David Sauvage
  0 siblings, 1 reply; 3+ messages in thread
From: Jérôme Haguet @ 2012-03-28 13:05 UTC (permalink / raw)


Hello 

My configuration : GNAT GPL 2011 / Windows 7

Some years ago, I had built a DLL with gnat.
As it was supposed to be used with non-Ada application, I had to export and call an initialization routine.
As detailed in §G.11 Gnat UG.
This was done with a simple makefile, calling gnatmake then gnatdll.

This process is still working with Gnat GPL 2011.

Now, I am trying to do the same with a gpr file.
I am able to build a DLL to be used with Ada application (in this case using GNAT shared runtime)
As detailed in $G.10 in Gnat UG.
But I am not able to build a DLL exporting its own initialization routine.
When building the library, the linker fails with following message: 
my_ada_lib.o:my_ada_lib.adb:(.text+0x77): undefined reference to `adainit'
my_ada_lib.o:my_ada_lib.adb:(.text+0x87): undefined reference to `adafinal'

Is it possible or not ? 
If yes, what is the setting I have omitted ? 

My gpr : 

library project my_ada_lib is

   for Languages use ("Ada");

   for Library_Name use "my_ada_lib";
   for Library_Kind use "dynamic";

   for Source_Dirs use (".");
   for Object_Dir   use "obj";
   for Library_Dir  use "..";

end my_ada_lib;





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

* Re: Building DLL with GNAT to be used with non-Ada application on Windows : some doubts
  2012-03-28 13:05 Building DLL with GNAT to be used with non-Ada application on Windows : some doubts Jérôme Haguet
@ 2012-03-29  8:00 ` David Sauvage
  2012-03-29 13:00   ` Jérôme Haguet
  0 siblings, 1 reply; 3+ messages in thread
From: David Sauvage @ 2012-03-29  8:00 UTC (permalink / raw)


On Mar 28, 5:05 pm, Jérôme Haguet <j.hag...@cadwin.com> wrote:
> Hello
>
> My configuration : GNAT GPL 2011 / Windows 7
>
> Some years ago, I had built a DLL with gnat.
> As it was supposed to be used with non-Ada application, I had to export and call an initialization routine.
> As detailed in §G.11 Gnat UG.
> This was done with a simple makefile, calling gnatmake then gnatdll.
>
> This process is still working with Gnat GPL 2011.
>
> Now, I am trying to do the same with a gpr file.
> I am able to build a DLL to be used with Ada application (in this case using GNAT shared runtime)
> As detailed in $G.10 in Gnat UG.
> But I am not able to build a DLL exporting its own initialization routine.
> When building the library, the linker fails with following message:
> my_ada_lib.o:my_ada_lib.adb:(.text+0x77): undefined reference to `adainit'
> my_ada_lib.o:my_ada_lib.adb:(.text+0x87): undefined reference to `adafinal'
>
> Is it possible or not ?
> If yes, what is the setting I have omitted ?
>
> My gpr :
>
> library project my_ada_lib is
>
>    for Languages use ("Ada");
>
>    for Library_Name use "my_ada_lib";
>    for Library_Kind use "dynamic";
>
>    for Source_Dirs use (".");
>    for Object_Dir   use "obj";
>    for Library_Dir  use "..";
>
> end my_ada_lib;

Would they be my_ada_libinit & my_ada_libfinal in your case ?

Cheers

$ nm libmy_ada_lib.so | grep init



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

* Re: Building DLL with GNAT to be used with non-Ada application on Windows : some doubts
  2012-03-29  8:00 ` David Sauvage
@ 2012-03-29 13:00   ` Jérôme Haguet
  0 siblings, 0 replies; 3+ messages in thread
From: Jérôme Haguet @ 2012-03-29 13:00 UTC (permalink / raw)


I got it ...

Solution was in chapter "1.5.3 Stand-alone Library Projects" of GPRbuild user's guide : 

I just add : 
   for Library_Interface use ("my_ada_lib");
and everything is working fine ...


Le jeudi 29 mars 2012 10:00:09 UTC+2, David Sauvage a écrit :
> 
> Would they be my_ada_libinit & my_ada_libfinal in your case ?
> 
> Cheers
> 
> $ nm libmy_ada_lib.so | grep init



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

end of thread, other threads:[~2012-03-29 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28 13:05 Building DLL with GNAT to be used with non-Ada application on Windows : some doubts Jérôme Haguet
2012-03-29  8:00 ` David Sauvage
2012-03-29 13:00   ` Jérôme Haguet

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