使用Robert Giesecke库的非托管DLL导出在Windows XP下不起作用 [英] Unmanaged DLL Export with Robert Giesecke Library Not Working Under Windows XP

查看:162
本文介绍了使用Robert Giesecke库的非托管DLL导出在Windows XP下不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个纯C#dll,我使用非托管DLL导出/罗伯特Giesecke编译成功,可以从C ++应用程序在Windows 7上运行时调用。该DLL是为Win32(x86)编译的。然后在Windows XP机器上运行相同的程序和DLL,可执行程序不能调用导出的DLL函数。



这里是导出函数的一个例子:

  [DllExport(SetTerminalHandle,CallingConvention = CallingConvention.Cdecl)] 

public static void SetTerminalHandle(int hTerminal ,string strTerminalPath,string strAccountServer)
{
terminalHandle = hTerminal;
terminalPath = strTerminalPath;
accountServer = strAccountServer;
}

任何想法。我知道要创建一个工作的Windows XP dll或exe在Win 7 w / VS 2012 for C ++中,您需要将编译器工具设置为平台设置为:Visual Studio 2012 - Windows XP(v110_xp)
您似乎不能使用C#编译器执行此操作。



任何想法?



谢谢

解决方案

对于X#,你不需要这样的东西,最重要的是你正在编译的.net框架..



最有可能的是,您编译的C#代码是与Windows XP不兼容的.net版本。



.NET 3.5将为您提供兼容性XP SP2。如果您希望与任何级别的XP兼容,则需要一直返回到.NET 2.0。


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

解决方案

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.

这篇关于使用Robert Giesecke库的非托管DLL导出在Windows XP下不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆