How to compile Matlab code for a .NET x86 application

조회 수: 5(최근 30일)
Yair Churi
Yair Churi 2014년 8월 13일
편집: Abhiram Bhanuprakash 2014년 10월 27일
I have complied Matlab code as a .NET dll. This code is working beautifully when the .NET application is set to x64. However, now I need to run this dll in an x86 .NET application. What are the steps to do this?
Looking at my Matlab installation (I have a 64 bit machine) I only have x64 (\Program Files\MATLAB\R2014a\toolbox\dotnetbuilder\bin\win64\v2.0) version of dotnetbuilder. Do I need to re install matlab as x86? and regenerate this dll? If so, can I do this on a x64 bit machine or do I need to get a 32 bit machine?

답변(1개)

Abhiram Bhanuprakash
Abhiram Bhanuprakash 2014년 10월 27일
편집: Abhiram Bhanuprakash 2014년 10월 27일
Hi Yair,
I think that the best way to do this is to do the following:
1. Install 32-bit MATLAB (on the 64-bit machine itself. No need of going for a 32-bit machine. Also, you can install both the 32-bit and 64-bit versions of MATLAB simultaneously on a 64-bit machine and they would function independently).
2. Regenerate the .NET DLL in 32-bit MATLAB
3. Install the 32-bit version of the MCR, and reference the 'MWArray.dll' of the 32-bit MCR installation while building the .NET application.
4. When you build your .NET application which references this 32-bit DLL in an environment like Visual Studio, make sure that you set the 'Active Solution Platform' to x86.
For Visual Studio, the following link would guide you on how to do this:
The above would avoid all errors possible and would be a fool-proof way of doing it.
You may also refer to the following thread for a similar question:

범주

Find more on Startup and Shutdown 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!

Translated by