comp.lang.ada
 help / color / mirror / Atom feed
* Linking an Ada DLL with MSVC++
@ 2002-10-10 20:06 Marc A. Criley
  2002-10-10 20:50 ` Stephen Leake
  2002-10-11 11:21 ` Marc A. Criley
  0 siblings, 2 replies; 3+ messages in thread
From: Marc A. Criley @ 2002-10-10 20:06 UTC (permalink / raw)


I've meticulously followed the instructions in the GNAT User Manual
for building a DLL, along with a Microsoft-style import library (i.e.,
the .lib and .exp files).

(This DLL is going to be linked into an existing MSVC++ application,
so it has to be done this way--no COM, no GNU C++, etc.)

I've been able to compile and build everything just fine, but the
linking is failing.

Here's a section from the Ada spec:

   procedure Initialize_Vmf_API;
   pragma Export(C, Initialize_VMF_API, "Initialize_VMF_API");

I build the DLL using gnatdll, build the .def file using dll2def, add
a LIBRARY line to the .def file, and build the import library using
MS's lib utility, all in accordance with the GNAT documentation.`

In the C++ app, I've added vmf_parser_api.lib to the
Project/Settings/Link modules entry.  I have a header file containing
the C function corresponding to the Ada procedure:

	void Initialize_VMF_API();

The header file is wrapped with 'extern "C" {' so as to avoid name
mangling.

But when I finally link, I get a message stating that there is an
"unresolved external symbol _Initialize_VMF_API", i.e., the function
name with a leading underscore.

I tried specifying a link name in the Export pragma having the leading
underscore, but still got the same error.

I've seen postings about other's successful experience linking, but
the postings talking about problems haven't had anything about this
one.

Thanks for any help.

Marc A. Criley



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

end of thread, other threads:[~2002-10-11 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-10 20:06 Linking an Ada DLL with MSVC++ Marc A. Criley
2002-10-10 20:50 ` Stephen Leake
2002-10-11 11:21 ` Marc A. Criley

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