简体   繁体   English

从32位C dll创建64位dll

[英]Create a 64 bit dll from a 32 bit C dll

I have a 32-bit dll that I have gotten from a third party. 我有一个32位的dll,我是从第三方获得的。 They have no 64 bit version. 他们没有64位版本。 I wish to load this dll into 64 bit python. 我希望将这个DLL加载到64位python中。 To do this, I need a 64 bit dll. 为此,我需要64位dll。 Is there a tool to convert a 32 bit dll to a 64 bit dll or is this impossible? 是否有工具将32位dll转换为64位dll或这是不可能的? If it impossible then I must use 32 bit python I guess. 如果不可能那么我必须使用32位python。

Only the vendor can do this, unless you get access to the DLL's source code. 只有供应商才能这样做,除非您可以访问DLL的源代码。 It must be recompiled for 64 bit. 它必须重新编译为64位。

I guess you'll have to use 32-bit python... 我想你将不得不使用32位python ...

32 and 64bit DLLS have different ABIs and calling conventions . 32位和64位DLLS具有不同的ABI调用约定 You just can't load a 32bit DLL into a 64bit process or the other way around. 您无法将32位DLL加载到64位进程中,反之亦然。

As mentioned in the comments, you have to recompile from source. 如评论中所述,您必须从源代码重新编译。

You can't create a 64-bit DLL from 32-bit one without the source code. 如果没有源代码,则无法从32位创建64位DLL。

But you can create an adapter as a native 32-bit application that loads the 32-bit DLL and provides access to it's functions via some kind of inter-process communications (eg named pipes) 但是您可以将适配器创建为本机32位应用程序,该应用程序可以加载32位DLL并通过某种进程间通信(例如命名管道)提供对其功能的访问

Of course, that's may be senseless in some cases and you may prefer to use 32-bit python. 当然,在某些情况下,这可能是毫无意义的,您可能更喜欢使用32位python。 So it depends. 所以这取决于。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM