comp.lang.ada
 help / color / mirror / Atom feed
* GNAT Project Manager and DLLs
@ 2008-02-19 14:02 marcelo.batera
  2008-02-19 20:28 ` marcelo.batera
  2008-02-19 21:16 ` Simon Wright
  0 siblings, 2 replies; 8+ messages in thread
From: marcelo.batera @ 2008-02-19 14:02 UTC (permalink / raw)


Hello there,

    I'm trying to generate some dll's (.so files as I'm in linux)
using gpr files but I'm stuck.

    The gpr file is at:

http://www.adaworks.net/adaworks/browser/trunk/awplug-samples/awplug-samples-plugin.gpr


    The problem is that it does not create a "samplepluginit" symbol
as I expected:


ogro@leibnis ~/dev/adaworks/trunk/awplug-samples $ nm pluginlib/
libsampleplug.so
000006dc r C.10.864
00002018 d DW.ref.__gnat_eh_personality
00001ee8 a _DYNAMIC
00001ff4 a _GLOBAL_OFFSET_TABLE_
         w _Jv_RegisterClasses
0000201c A __bss_start
         w __cxa_finalize@@GLIBC_2.1.3
0000200c d __dso_handle
         w __gmon_start__
         U __gnat_eh_personality
00000625 t __i686.get_pc_thunk.bx
0000201c A _edata
00002020 A _end
000006b4 T _fini
00000500 T _init
         U plug_interface__register
00002014 D sampleplug_E
00000640 T sampleplug___elabb
00000630 T sampleplug__void

    If I compile and bind it manually the library is successfully
built as expected.

    Is it possible to create a complete dll using gnat project
manager?

    I don't know how to elaborate more on this issue but the source
files for the entire project are available at svn://adaworks.net/adaworks/trunk
.

    For building this example I'm trying to run, just
            cd trunk/awplug-samples && make run
    The manually built version can be executed by
            cd trunk/awplug-samples && make mrun

    For those who don't know yet, AdaWorks is a project for creating a
complete framework for building business applications in Ada. It's
still in it's early stages of development - that's why we haven't made
the official announcement on this list yet.


Regards





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

* Re: GNAT Project Manager and DLLs
  2008-02-19 14:02 GNAT Project Manager and DLLs marcelo.batera
@ 2008-02-19 20:28 ` marcelo.batera
  2008-02-19 21:16 ` Simon Wright
  1 sibling, 0 replies; 8+ messages in thread
From: marcelo.batera @ 2008-02-19 20:28 UTC (permalink / raw)


On 19 fev, 12:02, "marcelo.bat...@gmail.com"
<marcelo.bat...@gmail.com> wrote:
> Hello there,
>
>     I'm trying to generate some dll's (.so files as I'm in linux)
> using gpr files but I'm stuck.
>
>     The gpr file is at:
>
> http://www.adaworks.net/adaworks/browser/trunk/awplug-samples/awplug-...
>
>     The problem is that it does not create a "samplepluginit" symbol
> as I expected:
>
> ogro@leibnis ~/dev/adaworks/trunk/awplug-samples $ nm pluginlib/
> libsampleplug.so
> 000006dc r C.10.864
> 00002018 d DW.ref.__gnat_eh_personality
> 00001ee8 a _DYNAMIC
> 00001ff4 a _GLOBAL_OFFSET_TABLE_
>          w _Jv_RegisterClasses
> 0000201c A __bss_start
>          w __cxa_finalize@@GLIBC_2.1.3
> 0000200c d __dso_handle
>          w __gmon_start__
>          U __gnat_eh_personality
> 00000625 t __i686.get_pc_thunk.bx
> 0000201c A _edata
> 00002020 A _end
> 000006b4 T _fini
> 00000500 T _init
>          U plug_interface__register
> 00002014 D sampleplug_E
> 00000640 T sampleplug___elabb
> 00000630 T sampleplug__void
>
>     If I compile and bind it manually the library is successfully
> built as expected.
>
>     Is it possible to create a complete dll using gnat project
> manager?
>
>     I don't know how to elaborate more on this issue but the source
> files for the entire project are available at svn://adaworks.net/adaworks/trunk
> .
>
>     For building this example I'm trying to run, just
>             cd trunk/awplug-samples && make run
>     The manually built version can be executed by
>             cd trunk/awplug-samples && make mrun
>
>     For those who don't know yet, AdaWorks is a project for creating a
> complete framework for building business applications in Ada. It's
> still in it's early stages of development - that's why we haven't made
> the official announcement on this list yet.
>
> Regards

got it


all I had to do is generate a Stand-alone Library.

http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Stand_002dalone-Library-Projects.html#Stand_002dalone-Library-Projects



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

* Re: GNAT Project Manager and DLLs
  2008-02-19 14:02 GNAT Project Manager and DLLs marcelo.batera
  2008-02-19 20:28 ` marcelo.batera
@ 2008-02-19 21:16 ` Simon Wright
  2008-02-19 22:45   ` Simon Wright
  2008-02-19 22:59   ` marcelo.batera
  1 sibling, 2 replies; 8+ messages in thread
From: Simon Wright @ 2008-02-19 21:16 UTC (permalink / raw)


The only differences I can see between a library of mine that does
create init/final symbols and yours (which don't here, Mac OS X/GNAT
GPL 2007) are that I have specified Library_Interface and
Library_Src_Dir. Doesn't seem enough.

After a bit of cross-platform hacking your 'make run' says

   cd pluginlib && ../bin/plug_sample


   Using the locator to load the plugin...
      Name            => sampleplug

   raised AW_PLUG.LOCATORS.PLUGIN_NOT_FOUND : sampleplug

which I take it is the problem!



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

* Re: GNAT Project Manager and DLLs
  2008-02-19 21:16 ` Simon Wright
@ 2008-02-19 22:45   ` Simon Wright
  2008-02-19 22:59   ` marcelo.batera
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Wright @ 2008-02-19 22:45 UTC (permalink / raw)


Simon Wright <simon.j.wright@mac.com> writes:

> The only differences I can see between a library of mine that does
> create init/final symbols and yours (which don't here, Mac OS X/GNAT
> GPL 2007) are that I have specified Library_Interface and
> Library_Src_Dir. Doesn't seem enough.

But Library_Interface was what was needed, wasn't it!



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

* Re: GNAT Project Manager and DLLs
  2008-02-19 21:16 ` Simon Wright
  2008-02-19 22:45   ` Simon Wright
@ 2008-02-19 22:59   ` marcelo.batera
  2008-02-20 20:38     ` Simon Wright
  1 sibling, 1 reply; 8+ messages in thread
From: marcelo.batera @ 2008-02-19 22:59 UTC (permalink / raw)


On 19 fev, 19:16, Simon Wright <simon.j.wri...@mac.com> wrote:
> The only differences I can see between a library of mine that does
> create init/final symbols and yours (which don't here, Mac OS X/GNAT
> GPL 2007) are that I have specified Library_Interface and
> Library_Src_Dir. Doesn't seem enough.
>
> After a bit of cross-platform hacking your 'make run' says
>
>    cd pluginlib && ../bin/plug_sample
>
>    Using the locator to load the plugin...
>       Name            => sampleplug
>
>    raised AW_PLUG.LOCATORS.PLUGIN_NOT_FOUND : sampleplug
>
> which I take it is the problem!


it's yet another problem.

as I stated earlier, the problem was not creating a stand-alone
library (which I solved using the Library_Interface option in the
sample's project file).


I haven't tested/ported it to MacOS X (I was going to do this today,
but I driven myself thinking about how to explain the use of AwPlug...
and I came up with a simple example of use and writing some sample
code - I still got to write some things... but well, that's not the
case).

The thing is: it's looking for a file named libsampleplug.so. Your
shared library might be called something else.


I'll work on this 'till next week and write an OS X port of awlib
(there where's the implementation for all the routines that are system
dependent).

btw: I know some Makefiles aren't cross platform, but they can be
easily changed and I intend use scons somewhere in the near future for
the entire project.



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

* Re: GNAT Project Manager and DLLs
  2008-02-19 22:59   ` marcelo.batera
@ 2008-02-20 20:38     ` Simon Wright
  2008-02-21 18:10       ` marcelo.batera
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Wright @ 2008-02-20 20:38 UTC (permalink / raw)


"marcelo.batera@gmail.com" <marcelo.batera@gmail.com> writes:

> I haven't tested/ported it to MacOS X (I was going to do this today,
> but I driven myself thinking about how to explain the use of AwPlug...
> and I came up with a simple example of use and writing some sample
> code - I still got to write some things... but well, that's not the
> case).

Are you building your own GNAT or using mine from SF GNUAda? If the
latter, then a couple of points --

(a) you need
   for Library_Options use ("-single_module");

(b) the version I uploaded only has static libraries which will make
it hard to create dynamic ones :-(

I've built gnatlib-shared, but there seem to be some problems on OS X
-- specifically, I have to set DYLD_LIBRARY_PATH to include the GNAT
adalib directory, or I get problems building a program that references
a dylib that references libgnat-2007.dylib or libgnarl-2007.dylib. I
don't think that a standard link uses the dylibs -- this may be what
configure --disable-libada does, of course.

> The thing is: it's looking for a file named libsampleplug.so. Your
> shared library might be called something else.

I ended up with libsampleplug.so.0.1.0 as the executable &
libsampleplug.dylib a symlink to it. This gets to the point of
printing

   Using the locator to load the plugin...
      Name            => sampleplug

at which point it stops.

> I'll work on this 'till next week and write an OS X port of awlib
> (there where's the implementation for all the routines that are
> system dependent).

This was of course using the src-linux bodies.



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

* Re: GNAT Project Manager and DLLs
  2008-02-20 20:38     ` Simon Wright
@ 2008-02-21 18:10       ` marcelo.batera
  2008-02-21 22:05         ` Vadim Godunko
  0 siblings, 1 reply; 8+ messages in thread
From: marcelo.batera @ 2008-02-21 18:10 UTC (permalink / raw)


I have another problem now.

When I unload the DLL created with the GPR file it fails miserably
later on when calling Ada.Text_IO.Put_Line( "some string" ), giving me
this exception:


raised ADA.IO_EXCEPTIONS.STATUS_ERROR : s-fileio.adb:187


It appears to me that, for some reason, when unloading the DLL it
messed up with GNAT runtime environment.


I tried for Library_Options use ("-single_module");  as well with no
success.



Any clue?



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

* Re: GNAT Project Manager and DLLs
  2008-02-21 18:10       ` marcelo.batera
@ 2008-02-21 22:05         ` Vadim Godunko
  0 siblings, 0 replies; 8+ messages in thread
From: Vadim Godunko @ 2008-02-21 22:05 UTC (permalink / raw)


On 21 фев, 21:10, "marcelo.bat...@gmail.com"
<marcelo.bat...@gmail.com> wrote:
> I have another problem now.
>
> When I unload the DLL created with the GPR file it fails miserably
> later on when calling Ada.Text_IO.Put_Line( "some string" ), giving me
> this exception:
>
DLL unloading is not safe for GNAT, especially if you are use
automatic initialization. GNAT's binder generate elaboration code for
all compilation unit inside DLL and all compilation units from which
DLL's units are dependent. You may avoid double elaboration by passing
-E to the gnatbind. But I don't known any way to avoid finalization of
all dependent units at the DLL unloading phase.



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

end of thread, other threads:[~2008-02-21 22:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19 14:02 GNAT Project Manager and DLLs marcelo.batera
2008-02-19 20:28 ` marcelo.batera
2008-02-19 21:16 ` Simon Wright
2008-02-19 22:45   ` Simon Wright
2008-02-19 22:59   ` marcelo.batera
2008-02-20 20:38     ` Simon Wright
2008-02-21 18:10       ` marcelo.batera
2008-02-21 22:05         ` Vadim Godunko

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