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

5 次查看(过去 30 天)
How can I compile a 32-bit dynamic link library using "build" in 64-bit MATLAB? Please.
  4 个评论
lei
lei 2020-8-27
Yes. Error executing "build (definemydll)" : mydll.lib: Warning LNK4272: Library computer type "X86" conflicts with target computer type "x64"

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2020-8-27
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.

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by