comp.lang.ada
 help / color / mirror / Atom feed
* Linking Ada and DLLs
@ 1999-03-12  0:00 J�r�me HAGUET
  1999-03-12  0:00 ` Martin C. Carlisle
  0 siblings, 1 reply; 2+ messages in thread
From: J�r�me HAGUET @ 1999-03-12  0:00 UTC (permalink / raw)


I am trying to build an  application in ADA linked with C DLLs. 
This DLLs use stdcall calling convention.

I built import library using dll2def and dlltool :
  dll2def imp_dll.dll > imp_dll.def
  dlltool --dllname imp_dll.dll --def imp_dll.def --output imp_dll.a

if I uses import (Stdcall, ada_name, "C_name"), link fails. If I uses import (C, ada_name,
"C_name"), link works but execution fails.

Can someone explain me why I cannot use stdcall ? 






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

* Re: Linking Ada and DLLs
  1999-03-12  0:00 Linking Ada and DLLs J�r�me HAGUET
@ 1999-03-12  0:00 ` Martin C. Carlisle
  0 siblings, 0 replies; 2+ messages in thread
From: Martin C. Carlisle @ 1999-03-12  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1340 bytes --]

In article <01be6cab$bc8e4380$40bd2bc0@pc-internet2>,
J�r�me HAGUET <j.haguet@cadwin.com> wrote:
>I am trying to build an  application in ADA linked with C DLLs. 
>This DLLs use stdcall calling convention.
>
>I built import library using dll2def and dlltool :
>  dll2def imp_dll.dll > imp_dll.def
>  dlltool --dllname imp_dll.dll --def imp_dll.def --output imp_dll.a
>
>if I uses import (Stdcall, ada_name, "C_name"), link fails. If I uses 
>import (C, ada_name,
>"C_name"), link works but execution fails.
>
>Can someone explain me why I cannot use stdcall ? 

As I recall, the problem is that dll2def doesn't create the appropriate
file.  I had to manually edit it to add the @8, @12, etc. to the end of
each export name, then add the -k flag to dlltool.

To figure out what extension to add, you can do one of two things:
1) If you already have a .lib file, look in it to see what the names
are.
2) Count up the number of bytes of arguments being passed (usually 4
per argument, unless you have doubles).  3 ints => @12 is the suffix.

--Martin

-- 
Martin C. Carlisle, Asst Prof of Computer Science, US Air Force Academy
carlislem@acm.org, http://www.usafa.af.mil/dfcs/bios/carlisle.html
DISCLAIMER:  This content in no way reflects the opinions, standards or 
policy of the US Air Force Academy or the United States Government.




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

end of thread, other threads:[~1999-03-12  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-12  0:00 Linking Ada and DLLs J�r�me HAGUET
1999-03-12  0:00 ` Martin C. Carlisle

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