vnmakarov / mir

A lightweight JIT compiler based on MIR (Medium Internal Representation) and C11 JIT compiler and interpreter based on MIR
MIT License
2.29k stars 145 forks source link

Export symbols in shared library on windows #330

Closed 5E-324 closed 1 year ago

5E-324 commented 1 year ago

Symbols in shared libraries are not imported and exported by default on Windows. For exporting, I added the property WINDOWS_EXPORT_ALL_SYMBOLS to target mir_shared. CMake doesn't provide a way to import all symbols in a shared library, for importing symbols properly, declspec(dllimport) is needed. Otherwise there will be a redundant jmp instruction, though the program still works. Currently I'm using `#define extern declspec(dllimport) extern`, hope there will be a proper fix.

vnmakarov commented 1 year ago

I've merge it. Thank you for this patch too.