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 9148931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:24:16+00:00 2026-06-17T11:24:16+00:00

I have created a DLL in MATLAB which provides me an interface to my

  • 0

I have created a DLL in MATLAB which provides me an interface to my .m functions.

Now I would like to use it with the MCR Runtime Library. (MCR = Matlab Compiler Runtime).

I am calling this DLL from within a C routine which eventually gets compiled with GCC (MinGW) into a wrapper DLL.

Now my function gets put into two forms:

extern LIB_XYZ_C_API 
bool MW_CALL_CONV mlxGet_path(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
extern LIB_XYZ_C_API bool MW_CALL_CONV mlfGet_path(int nargout, mxArray** p);

From these I choose the latter one as the former on seems to be kind of “old-style/legacy”.

I call it this way:

char get_path(LStrHandle path)
{
    char mret = init_XYZ(); // here I call mclmcrInitialize(), mclInitializeApplication(NULL, 0) etc.
    if (mret) return mret;
    mret = 2;
    // here the relevant part begins
    mxArray * mxpath = NULL; // set it to NULL and let the callee allocate it
    bool bret = mlfGet_path(1, &mxpath);
    // now I convert the mxpath to a string
    // What do I do with the mxpath afterwards?
    // I try to free it with
    mxDestroyArray(mxpath);
    return mret;
}

And here the trouble begins: mxDestroyArray() cannot be found in the linking process:

undefined reference to `mxDestroyArray'

If I manually add -llibmx to the build process, the build runs, but then libmx.dll cannot be found, as the MCR only puts $MCR\runtime\win32 into the path, but not $MCR\bin\win32 where the libmx.dll lives.

What can I do?

Do I have to choose a different “destroy” function when I use a self-compiled DLL?

Or do I have to fool around with the path? (I don’t hope so…)

Besides, there are other functions which are missing, but I think this would be resolved in the same way:

mxGetNumberOfElements
mxIsDouble
mxGetPr
mxGetM
mxGetN
mxGetData
mxIsChar
mxIsCell
mxDestroyArray
mxGetCell_730
mxSetCell_730
mxGetString_730
mxCalcSingleSubscript_730
mxGetNumberOfDimensions_730
mxCreateDoubleMatrix_730
mxCreateNumericMatrix_730
mxCreateCellMatrix_730
  • 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-06-17T11:24:18+00:00Added an answer on June 17, 2026 at 11:24 am

    I found out that it makes a big difference if the MCR is used or an installed MATLAB installation.

    1. Use -lmclmcrrt instead of -lmx and use the correct library path for the linker.
    2. Use the correct #include files in every file used in the compilation. Especially, don’t inter-mix #include "matrix.h" and the header file created together with the MATLAB DLL.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some MSVC++ compiled DLL's for which I have created COM-like (lite) interfaces
I have created a class library (dll) and I want to use this in
I have created a Class Library (called as GNGEngine.dll) which performs some image processing
I have created a managed dll and I would like to get the executable
We have a library created as both .lib and .dll (it's a big library
I have created a dll in C++ using a Class Library project in Visual
I have created a GUI which requires .dll files in order to work. Here
i have created a com class library with vb.net. i have registered the dll
I have created CMyClass,in which defined one method CallMe().when I build this project MyProject.dll
I have a dll created in c# which does some database operation upon calling.

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.