Error loading a 32bit DLL with 64bit Matlab
10 次查看(过去 30 天)
显示 更早的评论
I am trying to load a 32bit DLL using loadlibrary() in R2012a 64bit matlab on window 7. I have both the DLL and h files. I have added the DLL and h file locations to the environment path variable and matlab path.
The error I get from loadlibrary() is: dllname.dll is not a valid Win32 application.
While searching for an answere to my problem I have noticed Kaustubha Govind has stated the answer below several times:
- The "is not a valid Win32 application" error usually means that you are attempting to load a 32-bit DLL using 64-bit MATLAB. Perhaps there are no 64-bit versions of the NI DLLs available? You can try installing 32-bit MATLAB on your 64-bit machine and see if you are able to load the libraries from that installation.
I do not have a 64bit version of the DLL available.
Is there any way to load 32bit dll a 64bit matlab?
2 个评论
Image Analyst
2012-6-25
Good question. I just encountered the same thing today when someone asked me to run (on 64 bit Win7, 64 bit MATLAB) an old app where the author used a custom-written 32 bit DLL. The only solution I gave them was to run 32 bit MATLAB. I might be able to find the source code and perhaps if I could get it to recompile as a 64 bit DLL, it might work. I haven't tried that yet though. Maybe you can try that if you have the source code for the DLL.
采纳的回答
Walter Roberson
2012-6-26
Sorry, it is not possible to load a 32 bit dll from a 64 bit windows executable. This is an operating systems limitation (and also a limitation in the machine architecture.)
4 个评论
RobertF
2017-11-7
So now when 32-bits versions of MATLAB are no longer available (post 2015b), we have no way of using 32-bit DLLs?
Walter Roberson
2017-11-8
To use a 32 bit DLL with a 64 bit MATLAB, you need to have a "shim", such as an ActiveX control running as a separate process that you have the MATLAB session pass the requests to, the control calls the DLL, and sends back the results. This would not be transparent by any means.
This is not a MATLAB-specific issue. The last time I saw an operating system written for a higher number of bits able to call libraries written for a lower number of bits, it was the early 1980s involving a 32 bit Motorola 68000 operating system stuffing parameters into a globally-writable page and triggering a deliberate reset fault to allow the 16 bit Z80 to take over the processing.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!