Hello, I'm proceeding with my tests using kotlin/n...
# kotlin-native
f
Hello, I'm proceeding with my tests using kotlin/native to interact with a DLL on Windows (see thread https://kotlinlang.slack.com/archives/C3SGXARS6/p1642088820036200 and repo https://github.com/francescopedronomnys/kotlin-native-libcurl-dll). I was able to get it working with curl (as libcurl.dll) and I'm now trying to communicate with a different DLL (named libusbtocan.dll), so I've done what it looks like the same configuration on a new project (see the repo https://github.com/francescopedronomnys/kotlin-native-usb2can-dll ) but I cannot get it to compile, this is the error I get:
Copy code
The C:\Users\Francesco\.konan\dependencies\llvm-11.1.0-windows-x64-essentials/bin/clang++ command returned non-zero exit code: 1.
output:
lld-link: error: undefined symbol: CanalGetDllVersion
>>> referenced by Z:\BuildAgent\work\6326934d18cfe24e\kotlin\libraries\stdlib\src\kotlin\util\Result.kt:0
>>>               C:\Users\FRANCE~1\AppData\Local\Temp\konan_temp5544792713254776830\result.o:(libusbtocan_CanalGetDllVersion_wrapper14)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

FAILURE: Build failed with an exception.
Idea is able to resolve libusbtocan methods, so it looks like the linker (?) should be able to resolve that symbol. Do you have any hint? Thanks.
m
Quick googling for
CanalGetDllVersion
I presume it is something from https://www.8devices.com/products/usb2can Downloaded from that page drivers - "CANAL DLL" and "testApplication"; on quick glance I see that in test it defined as
_stdcall
and so mangled as
_CanalGetDllVersion@0
, and in zip from drivers - not mangled.
f
Hi Mike, sorry for my very late reply. You are right the DLL I was trying to use is from 8devices. Anyway I'm a totally noob with native, so I gave up and, finally, I was able to get my hands on the DLL source code. So I embedded my JNI methods directly on the original C++ source code and recompiled the DLL to be used directly from Kotlin/JVM. Thanks for your support, it was key to understand I should get support directly from 8devices.