简体   繁体   中英

Win32OLE used in 64 bit ruby cannot load 32 bit C++ Dll

I am trying to load a C++ DLL inside my Ruby application as a binary object. I have registered the Interface using regsrv32 and load the Dll using Win32OLE .. but if i am running a 64 bit variant of Ruby I cannot load a 32 bit C++ dll and visa versa. the only combinations that works are

32 bit ruby loads a 32 bit C++ Dll. 64 bit ruby loads a 64 bit C++ Dll

The only possible way I see here is to fork out a 32 bit ruby process to register and load the 32 bit dll via Win32OLE .

Old question, but no answer so far, so I try :).

As ruby is using 64bit and your COM+ might be 32 bit it will not run in library mode.

To solve this you register your COM+ component and afterwards you setup your dll to a server application in dcomcnfg.exe .

在此处输入图片说明

This will run your dll in a 32 bit dllhost.exe and then ruby can successful call your DLL via dll = WIN32OLE.new("your.dll")

Note: You might need to set an extra Identiy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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