comp.lang.ada
 help / color / mirror / Atom feed
From: "Beard, Frank" <beardf@spawar.navy.mil>
To: "'comp.lang.ada@ada.eu.org'" <comp.lang.ada@ada.eu.org>
Subject: RE: Calling Custom C Functions From Ada
Date: Tue, 21 Aug 2001 18:17:16 -0400
Date: 2001-08-21T18:17:16-04:00	[thread overview]
Message-ID: <mailman.998432370.18891.comp.lang.ada@ada.eu.org> (raw)

If you have access to the DUMPBIN.exe then you can 
run it against the DLL, LIB, etc.  It's part of the 
VC++ installation, but Aonix supplied it in the
<ObjectAda>\bin directory.  Maybe DDC-I does as well.
For DLLs the command is (run from DOS console):

    dumpbin /EXPORTS my.dll

It shows you the names by which the routines have been
exported.  I don't remember which option works on LIB and
OBJ files.  "DUMPBIN /ALL my.lib" will show you everything,
but it will be quite a bit of info.  "DUMPBIN /?" will
show you the list of options.

Hope this helps.
Frank

-----Original Message-----
From: Larry Hazel [mailto:lhazel@mindspring.com]
Sent: Tuesday, August 21, 2001 5:24 PM
To: comp.lang.ada@ada.eu.org
Subject: Re: Calling Custom C Functions From Ada


Brant wrote:
> 
> Hi Gang,
> 
> I'm trying to call a custom C function from an Ada program.  I've set
> my Ada program up using the INTERFACE pragma, but I can't seem to get
> the linker to locate the associated C object code.
> 
> I've written and built my C functions using Microsoft Visual C++; I've
> tried both static and dynamic libraries, so I get the *.lib, *.obj
> files along with a *.exp file.  I'm using a DDC-I DACS Ada compiler
> under Windows NT.
> 
> When I link my Ada code, which one of the generated C files do I need
> to reference?  No matter which I choose I get an "adalink: undefined
> reference to `MyFunction'" error, which is the same error I get when I
> don't even point to a file.  Do I need to do some tweaking of the C
> files?  Do I need to reference the specific function (as opposed to
> just a file) when I link?
> 
> Any help would be greatly appreciated!
> Thanks,
> Brant

IIRC, the C compiler mangles the name, so you must reference "_MyFunction"
or
something.  I'm not sure if the name mangling is the same for different C
compilers.

Larry
-- 
Larry Hazel
480 West Point Loop
Somerville, AL 35670-5533
_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada



             reply	other threads:[~2001-08-21 22:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-21 22:17 Beard, Frank [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-08-21 20:57 Calling Custom C Functions From Ada Brant
2001-08-21 21:22 ` Ted Dennison
2001-08-21 21:23 ` Larry Hazel
2001-08-22  2:01 ` Warren W. Gay VE3WWG
2001-08-22 16:45 ` Brant
replies disabled

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