You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no __declspec(dllexport) or __declspec(dllimport) in the header file, so Sonic cannot be used directly as a DLL without modification, because nothing would be exported. Compiling a Windows DLL requires functions to be explicitly exported.
A .def file can be added to export the functions as a workaround. However, the same header file is usually used when importing the functions as well. Without __declspec(dllimport), the compiler will assume that it is a regular extern function, and some optimizations for imported functions will not be applied.
To support compiling to both DLL and static library, #ifdef can be used to check a specific macro, for example SONIC_DLL. If not defined, __declspec(dllexport) and __declspec(dllimport) will not be added to keep the original behavior. Those who want to use Sonic as a DLL would have to predefine this macro.
There's a related pull request #27 but it hasn't been merged or closed for a long time. So @waywardgeek what's your thought about that?
The text was updated successfully, but these errors were encountered:
There's no
__declspec(dllexport)
or__declspec(dllimport)
in the header file, so Sonic cannot be used directly as a DLL without modification, because nothing would be exported. Compiling a Windows DLL requires functions to be explicitly exported.A .def file can be added to export the functions as a workaround. However, the same header file is usually used when importing the functions as well. Without
__declspec(dllimport)
, the compiler will assume that it is a regular extern function, and some optimizations for imported functions will not be applied.To support compiling to both DLL and static library,
#ifdef
can be used to check a specific macro, for exampleSONIC_DLL
. If not defined,__declspec(dllexport)
and__declspec(dllimport)
will not be added to keep the original behavior. Those who want to use Sonic as a DLL would have to predefine this macro.There's a related pull request #27 but it hasn't been merged or closed for a long time. So @waywardgeek what's your thought about that?
The text was updated successfully, but these errors were encountered: