Hi all,

I'm trying to call the following C function.

    RFC_RC _stdcall RfcUTF8ToSAPUC(const RFC_BYTE *utf8, unsigned
utf8Length,  SAP_UC *sapuc,
      unsigned *sapucSize, unsigned *resultLength, RFC_ERROR_INFO *info)

I wrote a foreign import for this function:

    foreign import ccall unsafe "sapnwrfc.h RfcUTF8ToSAPUC"
      f_RfcUTF8ToSAPUC :: RfcBytePtr -> CUInt -> SapUCPtr -> Ptr CUInt ->
Ptr CUInt -> RfcErrorInfoPtr -> IO RfcRetCodeType

But when compiling I keep getting this error:

C:\Temp\Haskell\HSAP>ghc --make -LC:/Temp/nwrfcsdk/lib -lsapnwrfc
SAP/Types.hs Test.hs
[1 of 2] Compiling SAP.Types        ( SAP/Types.hs, SAP/Types.o )
Linking Test.exe ...
SAP/Types.o(.text+0x91c):fake: undefined reference to [EMAIL PROTECTED]'
collect2: ld returned 1 exit status

I ran nm.exe on the sapnwrfc.lib to see the exports and got this list:

SAPNWRFC.dll:
00000000 I .idata$4
00000000 I .idata$5
00000000 I .idata$6
00000000 T .text
00000000 T [EMAIL PROTECTED]
         U __IMPORT_DESCRIPTOR_SAPNWRFC
00000000 I [EMAIL PROTECTED]

It looks like [EMAIL PROTECTED] exists. I tried prepending a _ but it
doesn't change anything.

GHC tries to link directly to the .dll file and not to the .lib file. Is
this a problem? Should I convert the .lib to a .a and link the .a?

Is there a way to list the exports directly from the dll file?

Thanks,

Olivier.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to