LoadLibrary with a dll the references other dlls

I am using Matlab 7.10 and in my .m file use loadlibrary to connect to an external device. (call this a.dll) I can call and use functionality within my a.dll fine.
I have trouble using my a.dll loaded when it loads in other libraries(call this b.dll and c.dll) within a.dll It cannot find them.
I have placed the other dlls(b.dll & c.dll) that my library(a.dll) references in the same matlab directory (with the m files)
I thought I might be able to use loadlibrary to get them into scope, but I do not have .h files for these other dlls (b.dll & c.dll) and that seems to be required, nor do I want to write out a prototype for each of these nested dlls(there are more then just b and c)
If I use 'pwd' my current directory returns my matlab directory, is there somewhere else these dlls(b.dll, c.dll) should be placed?
Thank you

 Accepted Answer

Hi,
a.dll can only find b.dll and c.dll, if b.dll and c.dll are on the system path (i.e., the path you get when you do
getenv('PATH')
Put c.dll to a folder on the system path (like c:\windows\system32) or add the folder to the system path.
Titus

2 Comments

Ok, investigating further appears I don't get a dll not found rather a ERROR_BAD_EXE_FORMAT
193 (0xC1)
which would be because I am on a 64 bit machine and the b.dll is a 32 bit?
Any clue on how to resolve this or am I best to create a new forum question?
Thanks for your help
Yes, you cannot load a 32-bit DLL into 64-bit MATLAB. You can install 32-bit MATLAB on your machine which should then allow you to load the DLL. See http://www.mathworks.com/support/solutions/en/data/1-579TVF/index.html?solution=1-579TVF for installation instructions and http://www.mathworks.com/support/solutions/en/data/1-1CAT7/ for caveats.

Sign in to comment.

More Answers (0)

Categories

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!