Build the 32-bit dynamic link library using "build" in 64-bit MATLAB2019b.

5 Ansichten (letzte 30 Tage)
lei
lei am 26 Aug. 2020
Kommentiert: lei am 28 Aug. 2020
How can I compile a 32-bit dynamic link library using "build" in 64-bit MATLAB? Please.
  4 Kommentare
lei
lei am 27 Aug. 2020
Yes. Error executing "build (definemydll)" : mydll.lib: Warning LNK4272: Library computer type "X86" conflicts with target computer type "x64"

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 27 Aug. 2020
You cannot do that.
The ability to interface to C++ libraries (instead of to libraries with a C interface) was added in R2019a, which is not supported on any 32 bit operating system.
It is an operating system limitation that 64 bit executables cannot call 32 bit libraries (not just a MATLAB limitation.) This is a limitation that is very common in operating systems: you would have to hunt around for a while to find an operating system that permitted that kind of behavior.
If you need to call a 32 bit library from a 64 bit program, the typical way to do that is to write a "surrogate" interface that receives the function call arguments and uses an interface such as TCP/IP to pass them to a 32 bit executable that you have written that listens for connections and decodes arguments and makes calls into the 32 bit library and packages the results and sends them back to the interface, which then makes appropriate local changes.
If the C++ library modifies variables (such as storing values into a buffer), then writing an appropriate surrogate interface can be a challenge, especially if there are pointers within the data structures. For example if there is a struct that contains a pointer then you need to take into account that pointers are 64 bits on the 64 bit side, but 32 bits on the 32 bit side.
In most of the cases, it is much easier to arrange for a recompilation of the library for 64 bits.

Kategorien

Mehr zu C Shared Library Integration finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by