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,3d1c21a87689d7bd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-12 05:25:42 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-meneldur.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Minimal pragma Export (StdCall... example? Date: Fri, 12 Mar 2004 14:36:23 +0100 Message-ID: <2de350pqsadlrvvgkrpc7261k31l5ejuap@4ax.com> References: NNTP-Posting-Host: tar-meneldur.cbb-automation.de (212.79.194.119) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1079097940 68587365 I 212.79.194.119 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:6268 Date: 2004-03-12T14:36:23+01:00 List-Id: On 12 Mar 2004 04:50:59 -0800, happysegfault@yahoo.com (Happy Segfault) wrote: >Dmitry A. Kazakov wrote in message news:... >> On 11 Mar 2004 05:31:24 -0800, happysegfault@yahoo.com (Happy >> Segfault) wrote: >> >> >I'm trying to write a DLL using GNAT 3.15p on Windows XP. The DLL needs to >> >export functions with the StdCall calling convention so that they can be >> >called from Visual Basic. Using samples/dll/ from the gwindows distribution >> >as a starting point, I haven't been successful in getting this to work. >> > >> >If I just change the occurrences of pragma Export (C... to pragma Export >> >(StdCall..., the Ada test driver program call_gw_dll.adb fails to link because >> >the link library libgw_in_a_dll.a exports "_pop_a_window" only, while the >> >linker wants "pop_a_window@0". Neither of these is the "_pop_a_window@0" I >> >would have expected to see for a StdCall function. >> > >> >Does anybody have a minimal set of code for a DLL, test program, and makefile >> >that demonstrates building a StdCall DLL using GNAT on Windows? >> >> Why do you use C convention? It should be rather >> >> pragma Export (StdCall, Local_Name [, "External_Name"]); > >That's what I'm trying to do, and I'm having the problems above. The pragma Export gives you an opportunity to explicitly specify the name used in the DLL. So you can name your Pop_A_Window as "pop_a_window@0". You can also move it to Visual Basic side, where you can explicitly specify the link name: Declare Function Pop_A_Window Lib "my_Ada.dll" Alias "_pop_a_window" (...) As Long Probably you want to automate it and omit specifying any link name altogether. I doubt it that is possible. Though you can always buy GNAT Pro and try to convince ACT (GNAT vendor) to implement pragma Export/Import (VisualBasic, ...); -- Regards, Dmitry Kazakov www.dmitry-kazakov.de