comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon.j.wright@mac.com>
Subject: Re: undefined reference to `adainit'
Date: Sun, 17 Feb 2008 22:12:35 +0000
Date: 2008-02-17T22:12:35+00:00	[thread overview]
Message-ID: <m2zltz44h8.fsf@mac.com> (raw)
In-Reply-To: 47b88598$1@news.broadpark.no

"news.broadpark.no" <etjensen@broadpark.no> writes:

> "Simon Wright" <simon.j.wright@mac.com> wrote in message
> news:m24pc75v4t.fsf@mac.com...
>> Are you trying to make a GNAT project file to (re)build the library,
>> or to use the already-built library? The one you post looks like the
>> former.
>>
>> I suspect your problem is the 'for Library_Auto_Init use
>> "False";'. Why is this here?
>
> I have a library with full source code that I will recompile. However,
> In the example I provided I have written a small DLL that I'm
> compiling. Compiling it thsi way works:
>
> gnatmake -c api
> gnatbind -n api
> gnatdll -d api.dll api.ali
>
> However, using GPS with the settings I provided does not work. Making
> the project gives the following output:
>
> gnatmake -PI:\Temp\ADATest\AdaDLL\api.gpr -d
> gnatbind -n -o b~api.adb -Lapi -a api.ali
> gcc -c b~api.adb
>
> building dynamic library for project api
> C:\GNAT\2007\bin\gcc.exe -shared -o 
> i:\temp\adatest\adadll\dll\api.dll
> -LC:/GNAT/2007/lib/gcc/pentium-mingw32msv/4.1.3/adalib/
> i:\temp\adatest\adadll\obj\api.o ... -L.\
> -Li:\temp\adatest\adadll\obj\
> -LC:/GNAT/2007/lib/gcc/pentium-mingw32msv/4.1.3/adalib/
> -Wl,--stack=0x2000000
> -LC:/GNAT/2007/lib/gcc/pentium-mingw32msv/4.1.3/adalib/ -lgnat-2007
> i:\temp\adatest\adadll\obj\api.o:api.adb:(.text+0x38): undefined
> reference to `adainit'
> i:\temp\adatest\adadll\obj\api.o:api.adb:(.text+0x57): undefined
> reference to `adafinal'
> collect2: ld returned 1 exit status
> gnatmake: gcc execution error

I'm having trouble with Windows, but the Mac OS X .dylib I'm working
on does this:

   gcc -c b~tash.adb -fPIC -O2 -fPIC -g -g

   building dynamic library for project build_tash_library
   /opt/gnat-gpl-2007-static/bin/gcc -dynamiclib -o /Users/simon/sf/tcladashell/lib/libtash.dylib -L/opt/gnat-gpl-2007-static/lib/gcc/powerpc-apple-darwin8.11.0/4.1.3/adalib/ -L./ -L/Users/simon/sf/tcladashell/src/.build_lib/ -L/opt/gnat-gpl-2007-static/lib/gcc/powerpc-apple-darwin8.11.0/4.1.3/adalib/ -L/usr/lib -ltk8.4 -ltcl8.4 -single_module -L/opt/gnat-gpl-2007-static/lib/gcc/powerpc-apple-darwin8.11.0/4.1.3/adalib/ -lgnarl-2007 -lgnat-2007 -Wl,-flat_namespace -shared-libgcc /Users/simon/sf/tcladashell/src/.build_lib/b~tash.o ...

which is quite similar except that (a) it works, (b) you have api.o
called up earlier.

HOWEVER -- it looks as though your api.adb itself explicitly calls
adainit, adafinal -- is that so? It shouldn't. My b~tash.adb defines
tashinit and tashfinal, and I believe these are what get called when
the dll is loaded/unloaded. adainit/adafinal are what GNAT generates
(by default?) when building an executable. I'd expect your b~api.adb
to define apiinit, apifinal.

I don't know why gnatdll doesn't give the same problem (it's not part
of the Mac build).

> I have problems seeing whats wrong. I have treid different settings
> for Library_Auto_Init, but with the same result.

I guess that's not the problem (but I think it should be "True", all
the same).



  reply	other threads:[~2008-02-17 22:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-16 22:39 undefined reference to `adainit' news.broadpark.no
2008-02-17 17:51 ` Simon Wright
2008-02-17 19:07   ` news.broadpark.no
2008-02-17 22:12     ` Simon Wright [this message]
2008-02-18  7:04 ` Martin Krischik
2008-02-18 20:44   ` news.broadpark.no
replies disabled

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