Can I load a 32-bit Dll library into a 64-bit version of MATLAB?

11 views (last 30 days)
Is it possible to load a 32-bit DLL library into a 64-bit version of MATLAB? Using the loadlibrary command generates an error--are there any reasonable workarounds to this problem?

Answers (2)

Walter Roberson
Walter Roberson on 8 Feb 2014
No you cannot do it in MATLAB, and there are no reasonable work-arounds other than using a 32 bit version of MATLAB.
I don't think it is impossible in theory, as it would be similar to using a two-tape Turing Machine; two-tape Turing machines can be turned into one-tape Turing machines by expanding the symbol set to the cross-product of all symbols on each tape. But importing more than (2^32) 64-bit addresses into 32 bit address space does get somewhat dicey.
  2 Comments
Hannetjie
Hannetjie on 27 Feb 2015
This is the first time in my life I've seen a clarification by means of Turing machine.
Sanjay Manohar
Sanjay Manohar on 5 Nov 2019
Edited: Sanjay Manohar on 5 Nov 2019
This is the best answer I have ever read. To any question.

Sign in to comment.


Daniel Goerke
Daniel Goerke on 9 Oct 2017
I also need to load a 32-bit DLL into a MATLAB using loadlibrary().
Unfortunately the 32-bit family of MATLAB is not supported in the latest version: https://de.mathworks.com/support/sysreq/roadmap.html
Did any kind of workaround come up to load 32-bit DLLs in 64-bit MATLAB (R2017b or later)?
Best regards, Daniel
  1 Comment
Guillaume
Guillaume on 9 Oct 2017
Edited: Guillaume on 9 Oct 2017
Please don't use the answer box for what is just a comment.
There are and never will be a workaround for this. Windows does not allow any 64-bit program to load any 32-bit dll.
If no 64-bit version of that dll exists and you cannot recompile it as 64-bit the only thing you can do is create a surrogate 32-bit exe which loads the 32-bit dll and a surrogate 64-bit dll that relay the calls from matlab to the exe through interprocess communication. This is not a trivial thing to do but is possible. As stated in the article, the work involved is probably as much as just rewriting the dll as 64-bit.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!