comp.lang.ada
 help / color / mirror / Atom feed
* Getting GNAT Ada DLL to work with MSVC++?
@ 2000-02-09  0:00 A Schoepel
  2000-02-10  0:00 ` David Botton
  2000-02-10  0:00 ` Craig Spannring
  0 siblings, 2 replies; 6+ messages in thread
From: A Schoepel @ 2000-02-09  0:00 UTC (permalink / raw)


I've 'successfully' created the DLL in GNAT, have a library
file and DLL file.  The Microsoft VC++ compiler gives me an
unresolved external symbol error when I link my C++ code
with the DLL.  I'm using CPP convention in the export
pragmas, have the correct definitions, identified the import
library in the MSVC++ compiler.  All the typical stuff.
What's even weirder is that the Windows environment can find
the DLL's function names when I use QuickView.

Has anyone successfully linked a GNAT DLL through the MSVC++
linker?  Did you encounter any weirdnesses like this?  Have
I missed some linking or binding options in GNAT?  Help?!

Andrew





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

* Re: Getting GNAT Ada DLL to work with MSVC++?
  2000-02-09  0:00 Getting GNAT Ada DLL to work with MSVC++? A Schoepel
@ 2000-02-10  0:00 ` David Botton
  2000-02-10  0:00   ` A Schoepel
  2000-02-10  0:00 ` Craig Spannring
  1 sibling, 1 reply; 6+ messages in thread
From: David Botton @ 2000-02-10  0:00 UTC (permalink / raw)


* Creating GNAT Dlls and using them from C (van Dijk & Marceau)
http://www.adapower.com/articles/howto-gdllc.html

Make sure that you have done an extern "c" {} on all your imports in your
C++ code

David Botton


A Schoepel wrote in message <38A24D1B.109879BA@mail.earthlink.net>...
>I've 'successfully' created the DLL in GNAT, have a library
>file and DLL file.  The Microsoft VC++ compiler gives me an
>unresolved external symbol error when I link my C++ code
>with the DLL.  I'm using CPP convention in the export
>pragmas, have the correct definitions, identified the import
>library in the MSVC++ compiler.  All the typical stuff.
>What's even weirder is that the Windows environment can find
>the DLL's function names when I use QuickView.
>
>Has anyone successfully linked a GNAT DLL through the MSVC++
>linker?  Did you encounter any weirdnesses like this?  Have
>I missed some linking or binding options in GNAT?  Help?!
>
>Andrew
>








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

* Re: Getting GNAT Ada DLL to work with MSVC++?
  2000-02-09  0:00 Getting GNAT Ada DLL to work with MSVC++? A Schoepel
  2000-02-10  0:00 ` David Botton
@ 2000-02-10  0:00 ` Craig Spannring
  2000-02-10  0:00   ` Robert Dewar
  1 sibling, 1 reply; 6+ messages in thread
From: Craig Spannring @ 2000-02-10  0:00 UTC (permalink / raw)


In article <38A24D1B.109879BA@mail.earthlink.net>,
A Schoepel  <schoepel@mail.earthlink.net> wrote:
>I've 'successfully' created the DLL in GNAT, have a library
>file and DLL file.  The Microsoft VC++ compiler gives me an
>unresolved external symbol error when I link my C++ code
>with the DLL.  I'm using CPP convention in the export
>pragmas, 

The CPP convention in gnat (probably) mangles names the same way as
g++.  MSVC++ probably doesn't.  You'll want to export the names with
the "C" convention.  The function declarations in your C++ header file
must specify C linkage as in

  extern "C"


-- 
=======================================================================
 Life is short.                  | Craig Spannring 
      Bike hard, ski fast.       | cts@internetcds.com
 --------------------------------+------------------------------------




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

* Re: Getting GNAT Ada DLL to work with MSVC++?
  2000-02-10  0:00 ` Craig Spannring
@ 2000-02-10  0:00   ` Robert Dewar
  2000-02-10  0:00     ` A Schoepel
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Dewar @ 2000-02-10  0:00 UTC (permalink / raw)


In article <COBo4.2905$eJ6.8171@newsfeed.slurp.net>,
  cts@kampong.aedinc.net (Craig Spannring) wrote:

> The CPP convention in gnat (probably) mangles names the same
> way as g++.  MSVC++ probably doesn't.

This is a guess, and it happens to be completely incorrect.
GNAT does not do any C++ name mangling. This is quite clear
from the GNAT documentation!


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Getting GNAT Ada DLL to work with MSVC++?
  2000-02-10  0:00 ` David Botton
@ 2000-02-10  0:00   ` A Schoepel
  0 siblings, 0 replies; 6+ messages in thread
From: A Schoepel @ 2000-02-10  0:00 UTC (permalink / raw)


I looked up and applied the example you pointed out.  The DLL links now
(thanks!), but my entire program exits when the DLL is called.  Heard of
anything like that?  Of course the function I am linking in to is not a
simple text string I/O thing either.

David Botton wrote:

> * Creating GNAT Dlls and using them from C (van Dijk & Marceau)
> http://www.adapower.com/articles/howto-gdllc.html
>
> Make sure that you have done an extern "c" {} on all your imports in your
> C++ code
>
> David Botton
>
> A Schoepel wrote in message <38A24D1B.109879BA@mail.earthlink.net>...
> >I've 'successfully' created the DLL in GNAT, have a library
> >file and DLL file.  The Microsoft VC++ compiler gives me an
> >unresolved external symbol error when I link my C++ code
> >with the DLL.  I'm using CPP convention in the export
> >pragmas, have the correct definitions, identified the import
> >library in the MSVC++ compiler.  All the typical stuff.
> >What's even weirder is that the Windows environment can find
> >the DLL's function names when I use QuickView.
> >
> >Has anyone successfully linked a GNAT DLL through the MSVC++
> >linker?  Did you encounter any weirdnesses like this?  Have
> >I missed some linking or binding options in GNAT?  Help?!
> >
> >Andrew
> >





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

* Re: Getting GNAT Ada DLL to work with MSVC++?
  2000-02-10  0:00   ` Robert Dewar
@ 2000-02-10  0:00     ` A Schoepel
  0 siblings, 0 replies; 6+ messages in thread
From: A Schoepel @ 2000-02-10  0:00 UTC (permalink / raw)


Thanks everyone!  I got the &*%$ thing to work finally.  I was
trying to use a Interfaces.C type, which I thought I was doing
correctly, but wasn't and it caused the whole thing to go south!
As soon as I got rid of that type and just tried to do my primary
processing (without the little goodie) everything worked fine.






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

end of thread, other threads:[~2000-02-10  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-09  0:00 Getting GNAT Ada DLL to work with MSVC++? A Schoepel
2000-02-10  0:00 ` David Botton
2000-02-10  0:00   ` A Schoepel
2000-02-10  0:00 ` Craig Spannring
2000-02-10  0:00   ` Robert Dewar
2000-02-10  0:00     ` A Schoepel

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