From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1360213b539060b5,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-10 13:06:07 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mcq95@earthlink.net (Marc A. Criley) Newsgroups: comp.lang.ada Subject: Linking an Ada DLL with MSVC++ Date: 10 Oct 2002 13:06:07 -0700 Organization: http://groups.google.com/ Message-ID: <254c16a.0210101206.34540dda@posting.google.com> NNTP-Posting-Host: 12.158.183.114 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1034280367 18515 127.0.0.1 (10 Oct 2002 20:06:07 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 10 Oct 2002 20:06:07 GMT Xref: archiver1.google.com comp.lang.ada:29689 Date: 2002-10-10T20:06:07+00:00 List-Id: 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