comp.lang.ada
 help / color / mirror / Atom feed
From: Patrick Noffke <patrick.noffke@gmail.com>
Subject: Re: calling Ada dll from C?
Date: Mon, 23 Mar 2015 06:42:03 -0700 (PDT)
Date: 2015-03-23T06:42:03-07:00	[thread overview]
Message-ID: <a019111f-509f-4362-964c-dbb52f9a7390@googlegroups.com> (raw)
In-Reply-To: <85lhiomb20.fsf@stephe-leake.org>

On Monday, March 23, 2015 at 2:23:54 AM UTC-5, Stephen Leake wrote:
> Simon Wright writes:
> 
> > Stephen Leake writes:
> >
> >> A related issue is 'adainit'. According to "(gnat_ugn) Binding with
> >> Non-Ada Main Programs", since the main program is not in Ada, I'm
> >> supposed to run gnatbind with -n, and then call 'adainit' from the C
> >> main program.
> >>
> >> However, since I'm only building a dll, not a main program, it appears
> >> gnatbind is not run, so no 'adainit' is generated.
> >
> > You need to build a 'stand-alone library'[1]. If the library is dynamic,
> > the default is to do automatic initialization (i.e. elaboration) on load
> > (and finalization on unload?).
> 
> Thanks for the pointer, but that did not help.
> 
> I made it work by building a static Ada library, running gnatbind -n on
> that directly to generate adainit, writing a C wrapper to call adainit,
> and building the dll by linking together the C wrapper, the Ada static
> library and the GNAT runtime using 'gcc -shared'.
> 
> However, that only works on Windows; Debian still gives "file not
> found".
> 
> Does anyone know why the loader does not say _which_ file is not found?
> It is _extremely_ frustrating to not be able to better diagnose this!
> 

Did you try using strace?

Is it as simple as setting your LD_LIBRARY_PATH environment variable?

Pat

  parent reply	other threads:[~2015-03-23 13:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21  9:43 calling Ada dll from C? Stephen Leake
2015-03-21 14:19 ` Simon Wright
2015-03-23  7:23   ` Stephen Leake
2015-03-23  8:36     ` Dmitry A. Kazakov
2015-03-23 13:42     ` Patrick Noffke [this message]
2015-03-25 20:48     ` Stephen Leake
replies disabled

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