terralang / terra

Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.
terralang.org
Other
2.72k stars 201 forks source link

anyway to export symbols from DLL on windows? #462

Closed fastcoding closed 4 years ago

fastcoding commented 4 years ago

the codes below can produce dll, but cannot export test function.

local C=terralib.includec'stdio.h' 
terra test() 
  C.printf('hello world\n') 
end
terralib.saveobj('test.dll',{test=test})  

dumpbin /exports test.dll ( no exports at all )

ErikMcClure commented 4 years ago

Exports on windows are always a bit messy, you can attempt to force the linker to do this for you by passing the /EXPORT:symbolname argument through to the linker, but I'm not sure if this will work.

fastcoding commented 4 years ago

Just tested, it works! This is an option provided by microsoft linker, that means clang will launch link.exe to do that job. thanks for your help.

Exports on windows are always a bit messy, you can attempt to force the linker to do this for you by passing the /EXPORT:symbolname argument through to the linker, but I'm not sure if this will work.