C # calls C++ API
An unhandled exception of type 1 System.DllNotFoundException occurs in test.exe additional information: unable to load DLL "DLL/AR_ALGORITHM.dll": the specified module could not be found. (the exception comes from HRESULT:0x8007007E).
The reason for this problem is that the program cannot find AR_ALGORITHM.dll. Usually, the program looks in the bin directory, the system32 directory, and the current directory where the program is running.
2 unhandled exceptions of type "System.EntryPointNotFoundException" occur in test.exe
Additional information: the entry point named "WGStoGCJ" cannot be found in DLL ".. / DLL/AR_ALGORITHM.dll".
WINAPI is specified in the function declaration of C++, but Cdecl is specified in the C# redefinition of the corresponding call. In fact, Winapi should be specified, or simply nothing.
[DllImport (".. / DLL/AR_ALGORITHM.dll", EntryPoint = "WGStoGCJ", CallingConvention = CallingConvention.Cdecl)]
Simple and correct
[DllImport (".. / DLL/AR_ALGORITHM.dll")]
Then from the application point of view, what is the difference or attention in the use of functions marked with WINAPI and unmarked with WINAPI?
That's the difference between a system and a non-system function.
In terms of application, there is not much difference, as long as the declaration is correct.
For example, if you write a library function with WINAPI declaration, and others must use WINAPI declaration when calling it, otherwise the runtime will make an error.