entrypoint 'function' is not __stdcall with 12 bytes of arguments; image may not run
The entry point for a DLL must be __stdcall. Either recompile the function with the /Gz option or specify __stdcall or WINAPI when you define the function.