comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Minimal pragma Export (StdCall... example?
Date: Fri, 12 Mar 2004 14:36:23 +0100
Date: 2004-03-12T14:36:23+01:00	[thread overview]
Message-ID: <2de350pqsadlrvvgkrpc7261k31l5ejuap@4ax.com> (raw)
In-Reply-To: ed66a020.0403120450.af919b0@posting.google.com

On 12 Mar 2004 04:50:59 -0800, happysegfault@yahoo.com (Happy
Segfault) wrote:

>Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote in message news:<d6s0501t3r52o1aikiedgcbh65q2rfhuvr@4ax.com>...
>> 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



  reply	other threads:[~2004-03-12 13:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-11 13:31 Minimal pragma Export (StdCall... example? Happy Segfault
2004-03-11 14:03 ` Dmitry A. Kazakov
2004-03-12 12:50   ` Happy Segfault
2004-03-12 13:36     ` Dmitry A. Kazakov [this message]
2004-03-14  1:01       ` Happy Segfault
2004-03-16 13:54         ` Happy Segfault
2004-03-11 15:00 ` Frank
2004-03-12 13:02   ` Happy Segfault
replies disabled

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