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 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-10 14:00:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Linking an Ada DLL with MSVC++ Date: 10 Oct 2002 16:50:31 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <254c16a.0210101206.34540dda@posting.google.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1034283677 24600 128.183.220.71 (10 Oct 2002 21:01:17 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 10 Oct 2002 21:01:17 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:29693 Date: 2002-10-10T21:01:17+00:00 List-Id: mcq95@earthlink.net (Marc A. Criley) writes: > 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). > > > > procedure Initialize_Vmf_API; > pragma Export(C, Initialize_VMF_API, "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. Back when I was doing this with GNAT 3.12 and Borland C++, I added the underscore in the external name: pragma Export (C, Initialize_VMF_API, "_Initialize_VMF_API"); That worked. There is also the problem of which C calling convention the C++ compiler is using; Cdecl or stdcall. That can influence which link name it looks for. -- -- Stephe