从DLL 64位加载和调用DLL 32位 [英] LOAD and CALL DLL 32 bit from DLL 64 bit

查看:550
本文介绍了从DLL 64位加载和调用DLL 32位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

 

我有64位DLL,而我有32位dll,我无法重新编译.

I have 64 bit DLL and I have 32 bit dll that I can't re-compile.

我想从我的64位dll调用一个方法转换为32位DLL.我尝试使用LoadLibraryEx(),但是getProcessAddress不起作用.

I want to call from my 64 bit dll a method into 32 bit DLL. I try to use LoadLibraryEx() but then the getProcessAddress doesn't work.

我该怎么办?

代码是:


typedef int (*startOrder)();
HINSTANCE hLib = LoadLibraryEx(L"my32bit.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
		
//acutPrintf(L"\nLoadLibraryEx");
startOrder start;
if (hLib !=NULL)
	{
			
		//acutPrintf(L"\nLoadLibraryEx != NULL");
			
		start=(startOrder)GetProcAddress(hLib,"StartOrder");
			
		if (!start)
			;
		else
		{
			start();
		}
		FreeLibrary(hLib);
	}
	else
    {
		//Printf(L"\nLoadLibrary == NULL");
		
	}

推荐答案

您不能将32位DLL加载到64位中过程.那是行不通的.

You cannot load a 32bit-DLL into a 64bit process. That will not work.

您唯一可以做的事:

1.开始一个新的加载32位DLL的32位进程

1. Start a new 32-bit process which load the 32bit DLL

2.与64位和32位进程之间的InterProcessCommunication进行通信.

2. Comunicate with InterProcessCommunication between the 64 and 32bit processes.


这篇关于从DLL 64位加载和调用DLL 32位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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