Unable to load dll using MATLAB 2012b
6 views (last 30 days)
Show older comments
Hi, I am trying to load a 64bit dll using 64bit MATLAB 2012b but get an error that I don't know how to get rid of. I was wondering if anyone can help.
Before using loadlibrary function, I installed Microsoft Windows SDK 7.1. Then I installed SDK 7.1 patch from Microsoft as it is suggested in the following link:
After installation, mex -setup is able to find SDK 7.1:
[1] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
But I don't know why it is in x86 folder, but I had no choice so I chose this one as compiler.
Then I used loadlibrary to load the dll, but it gives me the following error message:
Error using loadlibrary (line 419) There was an error loading the library "D:\Lingmei\Interface\dsApi.dll" D:\Lingmei\Interface\dsApi.dll is not a valid Win32 application.
The only possible cause that I can think of is that the location of compiler is under x86 path. But SDK 7.1 and its path have only one version, there is no 64bit or 32bit choice. Or maybe something else has to be done but I don't know.
Can anyone give some suggestions? Thanks a lot.
0 Comments
Answers (1)
Roja
on 25 Jun 2014
This error might occur if your 64-bit dll is dependent on any 32-bit dll.
You can find if such a dependency is existing using Dependency Walker. Dependency Walker is a free tool that allows you to view the dependencies of your DLL or EXE file. In addition, you can profile your module to view the runtime dependencies. The following link provides information on how to use Dependency Walker.
If such a dependency exists,I would suggest you to match the bitness of dll's.
0 Comments
See Also
Categories
Find more on C Shared Library Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!