vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.88k stars 2.17k forks source link

Can not load custom dll written in c on windows #10987

Closed robotcc closed 3 years ago

robotcc commented 3 years ago

I'm trying to write a wrap for a third party lib. import has got no error , but the program did not run. Is there any log for me to check what's wrong with it? QQ图片20210728203321

JalonSolov commented 3 years ago

The import in V is for importing V modules, not DLLs or other shared libraries.

You'll need to look at these instructions for ideas on calling DLL routines:

https://github.com/vlang/v/blob/master/doc/docs.md#calling-c-from-v

You can also look at files with names ending in _windows.v and _windows.c.v in the vlib subdirectories for examples of calling Windows routines from V.

robotcc commented 3 years ago

Thanks!But still I haven't got an idea. compile is ok, couldn't run

robotcc commented 3 years ago

"v run .\test.v " will create an exe in current directory, and the directory should have *.dll inside. That's why my test.v can not run.