comp.lang.ada
 help / color / mirror / Atom feed
From: "Gerd" <GerdM.O@t-online.de>
Subject: Problem creating bindings - please help
Date: 17 May 2006 23:46:23 -0700
Date: 2006-05-17T23:46:23-07:00	[thread overview]
Message-ID: <1147934783.645893.274580@u72g2000cwu.googlegroups.com> (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




             reply	other threads:[~2006-05-18  6:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-18  6:46 Gerd [this message]
2006-05-18  7:57 ` Problem creating bindings - please help 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
replies disabled

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