问题
I have a pure C# dll that I compiled using Unmanaged DLL Export / Robert Giesecke which compiles successfully and can be called from a C++ application when running on Windows 7. The DLL is compiled for Win32 (x86). Then the same program and DLL are run on a windows XP machine the executable program cannot call the exported DLL function.
here is an example of the exported function:
[DllExport("SetTerminalHandle", CallingConvention = CallingConvention.Cdecl)]
public static void SetTerminalHandle(int hTerminal, string strTerminalPath, string strAccountServer)
{
terminalHandle = hTerminal;
terminalPath = strTerminalPath;
accountServer = strAccountServer;
}
Any ideas. I know that to create a working Windows XP dll or exe under Win 7 w/ VS 2012 for C++ you need to set the compiler tool to Platform Set to: Visual Studio 2012 - Windows XP (v110_xp) You cannot seem to do this with the C# compiler.
Any Ideas ?
Thanks
回答1:
For X# you do not need this kind of stuff, the most important thing is the .net framework you are compiling against..
Most likely you compiled your C# code against a .net version which is not compatible with Windows XP.
.NET 3.5 will give you compatibility with XP SP2. If you want compatibility with any level of XP, you need to go all the way back to .NET 2.0.
来源:https://stackoverflow.com/questions/20849836/unmanaged-dll-export-with-robert-giesecke-library-not-working-under-windows-xp