Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6943729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:11:39+00:00 2026-05-27T13:11:39+00:00

I am currently building a 32-bit MatLab-engine application in c++ on a 64 bit

  • 0

I am currently building a 32-bit MatLab-engine application in c++ on a 64 bit machine, with 64-bit MatLab installed. However, I do have all the dll’s and library files in 32-bit for the MatLab engine. The library files and dll’s are loaded correctly (I can compile and start the application without getting any errors I would get when I use the 64-bit dll’s/libs), but the 32-bit dll’s apparently launch the 64-bit matlab executable, so my program crashes as soon as I try to do something with the engine. Is there a way I can make my application launch the 32-bit matlab executable instead of the 32-bit one?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:11:40+00:00Added an answer on May 27, 2026 at 1:11 pm

    It is possible, but it’s extremely messy: the whole mbuild/deploytool system is a piece of cr*p in my opinion. First problem with deploytool.bat is that, although having a ‘-win32’ option, that has no effect whatsoever when deploytool is not invoked from the 32bit install directory. Second problem is that the mbuild options are shared for 32 and 64 bit versions so they have to be specified manually as else the wrong compiler options are used.

    Here are some things I did to compile both 32bit and 64bit from a 64bit windows machine with VS2010 installed.

    • you have to install both 32bit and 64bit matlab versions
    • you’ll have to do everything from the command line
    • you can never edit your .prj files via the deploytool ui because it screws up all manual changes made to them. (well, that is actually a benefit since now at least you’ll be able to store them in a VCS)
    • point to the correct compiler options by adding <param.c.cpp.options.file> to the prj under the ‘configuration` section (see below)
    • build by manully giving the full path to the deploytool.bat of the 32 bit installation

    options file config in prj:

    <deployment-project>
      <configuration ....>
        ....
        <param.c.cpp.options.file>${MATLAB_ROOT}\bin\win32\mbuildopts\msvc100compp.bat</param.c.cpp.options.file>
        ....
    

    Note that output dir etc will be the same for the 32bit and 64bit versions. In practice, if you have to do this for multiple projects this becomes totally unmanagable. So I have an msbuild script to make life easier: basically in the prj file I replace everything platform dependent (output dir, matlab root dir, options file location) by macros, then let msbuild copy the prj and do a regex find/replace of the macros with values depending on platform. This allows using the same prj for both platforms.

    Update

    After a few major changes to our projects we found that eventually the hassle of dealing with the matlab prj files was not worth it. Instead, we greatly simplified everything by invoking mcc directly and feed it with all files belonging to a project. Here is the relevant msbuild code; some error checking skipped for clarity:

    <Target Name="BuildMatlabProject">
      <PropertyGroup Condition="$(MlPlatform)=='x86'">
        <MlMatlabBinDir>$(MlMatlabx86Dir)\bin\win32</MlMatlabBinDir>
      </PropertyGroup>
      <PropertyGroup Condition="$(MlPlatform)=='x64'">
        <MlMatlabBinDir>$(MlMatlabx64Dir)\bin\win64</MlMatlabBinDir>
      </PropertyGroup>
      <ItemGroup>
        <MlMFiles Include="$(MlMatlabProjDir)\*.m"/>
        <MlMResources Include="$([System.IO.Directory]::GetDirectories(&quot;$(MlMatlabSrcDir)&quot;))"/>
      </ItemGroup>
      <PropertyGroup>
        <MlMresourcseString Condition="@(MlMResources)!=''"> -a @(MlMResources, ' -a ')</MlMresourcseString>
      </PropertyGroup>
      <RemoveDir Directories="$(MlOutDir)" ContinueOnError="true"/>
      <MakeDir Directories="$(MlOutDir)"/>
      <Exec Command="$(MlMatlabBinDir)\mcc -W cpplib:$(MlOutputName)_$(MlPlatform)
     -T link:lib -d $(MlOutDir) -f $(MlMatlabBinDir)\mbuildopts\msvc100compp.bat
     -w enable:specified_file_mismatch -w enable:repeated_file -w enable:switch_ignored
     -w enable:missing_lib_sentinel -w enable:demo_license -v
     @(MlMFiles, ' ') $(MlMresourcseString)"/>
    </Target>
    

    It needs these properties:

    • MlPlatform: x86 to build 32 bit, x64 to build 64 bit
    • MlMatlabx86Dir: path to matlab 32bit install dir
    • MlMatlabx64Dir: path to matlab 64bit install dir
    • MlMatlabProjDir: path to ‘project’ dir with m-files to compile
    • MlMatlabSrcDir: path with extra source m-files
    • MlOutDir: output directory
    • MlOutputName: output name
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For an application I am building I have drawn 2 circles. One a bit
I currently use Ant to build Java software. However, all development that I have
I am currently building in Version 3.5 of the .Net framework and I have
I am currently building an internal web application used in a factory/warehouse type location.
We're currently building an application that executes a number of external tools. We often
I'm currently building a small web application that includes a fair amount of JavaScript.
I am currently building an application using ASP.NET MVC. The data entry pages are
For one of my clients I'm currently building an application that communicates with a
We're currently building a system that abstracts all kinds of technical details about web
I'm building a Rails application that deals with file uploads through CarrierWave. Currently, larger

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.