__declspec(dllexport)
is used to inform the compiler that this function or class is used as a public library, and __declspec(dllimport)
is used to inform the compiler that this function or class is not defined in the current file and will be imported from other DLL files.
library.dll
__declspec(dllexport) void func()
{
// ...
}
main.c
__declspec(dllimport) void func();
int main()
{
func();
reutrn 0;
}
Link this library at compile time.