comp.lang.ada
 help / color / mirror / Atom feed
* Problem creating bindings - please help
@ 2006-05-18  6:46 Gerd
  2006-05-18  7:57 ` Dmitry A. Kazakov
  2006-05-19  3:25 ` Steve
  0 siblings, 2 replies; 9+ messages in thread
From: Gerd @ 2006-05-18  6:46 UTC (permalink / raw)


Hi all,

I tried to create my own Ada bindings for a dll, but I didn't succeed.


The C-header contains:

DWORD __stdcall CAN_GetHwParam(
        HCANHW hHw,
        WORD   wParam,
        void*  pBuff,
        WORD   wBuffLen);


My Ada-spec look like this:

with System;

package CanApi2 is

pragma Linker_Options ("-lCanApi2");

subtype
  HCANHW is Integer;

subtype
  Word is Integer;

function CAN_GetHwParam (hHw : HCANHW; wParam : Word; pBuff :
System.Address; wBuffLen : Word) return Integer;

private
    pragma Import (Stdcall, CAN_GetHwParam, External_Name =>
"CAN_GetHwParam");
end CanApi2;

The lib-file (CanApi2.lib) contains this names:

 _CAN_GetHwParam@16 __imp__CAN_GetHwParam@16 _CAN_SetHwParam@12
__imp__CAN_SetHwParam@12


And that's what I get when build my test-program:

C:\Work\CAN>gnatmake cantest
gcc -c cantest.adb
gcc -c canapi2.ads
gnatbind -x cantest.ali
gnatlink cantest.ali
./cantest.o(.text+0x264):cantest.adb: undefined reference to
`CAN_GetHwParam@16'

gnatlink: cannot call C:\GNAT\bin\gcc.exe
gnatmake: *** link failed.

DLL2DEF shows this:

EXPORTS
	CAN_GetHwParam


So what's wrong with my code? Please help, thanks.

Gerd




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

end of thread, other threads:[~2006-05-19  8:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-18  6:46 Problem creating bindings - please help Gerd
2006-05-18  7:57 ` Dmitry A. Kazakov
2006-05-18 10:51   ` Gerd
2006-05-18 11:24     ` christoph.grein
2006-05-18 12:02       ` Gerd
2006-05-18 12:15         ` Georg Bauhaus
2006-05-18 12:32     ` Dmitry A. Kazakov
2006-05-19  8:30       ` Gerd
2006-05-19  3:25 ` Steve

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