Hi all,<br><br>I'm trying to call the following C function.<br><br> RFC_RC _stdcall RfcUTF8ToSAPUC(const RFC_BYTE *utf8, unsigned utf8Length, SAP_UC *sapuc, <br> unsigned *sapucSize, unsigned *resultLength, RFC_ERROR_INFO *info)<br>
<br>I wrote a foreign import for this function:<br><br> foreign import ccall unsafe "sapnwrfc.h RfcUTF8ToSAPUC"<br> f_RfcUTF8ToSAPUC :: RfcBytePtr -> CUInt -> SapUCPtr -> Ptr CUInt -> Ptr CUInt -> RfcErrorInfoPtr -> IO RfcRetCodeType<br>
<br>But when compiling I keep getting this error:<br><br>C:\Temp\Haskell\HSAP>ghc --make -LC:/Temp/nwrfcsdk/lib -lsapnwrfc SAP/Types.hs Test.hs<br>[1 of 2] Compiling SAP.Types ( SAP/Types.hs, SAP/Types.o )<br>Linking Test.exe ...<br>
SAP/Types.o(.text+0x91c):fake: undefined reference to `RfcUTF8ToSAPUC@24'<br>collect2: ld returned 1 exit status<br><br>I ran nm.exe on the sapnwrfc.lib to see the exports and got this list:<br><br>SAPNWRFC.dll:<br>00000000 I .idata$4<br>
00000000 I .idata$5<br>00000000 I .idata$6<br>00000000 T .text<br>00000000 T _RfcUTF8ToSAPUC@24<br> U __IMPORT_DESCRIPTOR_SAPNWRFC<br>00000000 I __imp__RfcUTF8ToSAPUC@24<br><br>It looks like RfcUTF8ToSAPUC@24 exists. I tried prepending a _ but it doesn't change anything.<br>
<br>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?<br><br>Is there a way to list the exports directly from the dll file?<br><br>
Thanks,<br><br>Olivier.<br>