Trying to use Matlab dll


I need help for using in Xojo a dll I compiled from Matlab. Making this work would potentially open many possibilities since matlab offers functionality that is hard to get in Xojo.

I wrote two simple functions and executed some compile sentence I found by googling. Matlab is using visual C++ 2010 for the compilation (required install to make it work). This generated a dll and several other files (including the corresponding header files).

I have zipped all the files that were created here:

There is also a Xojo sample project in which there are two pushbuttons declaring the two functions I meant to include in the dll.

To try this I compiled the Xojo project and copied the dll to the application libs folder. Run the project and I got an functionnotfoundexception when trying to access the fucntions in the dll.

I know there are different types of dlls and that not all are compatible with Xojo, but that’s about all I know about dlls. I also don’t know much C/C++/C#/… or what the differences between them are.


  • Could anyone check my project (six lines of code)?
  • Could anyone explain to me what kind of dll I would need to try to generate, and what the difference with the other dlls is?

I am almost sure that the dll will require an additional framewrok (Matlab Compiler Runtime Libraries) so it is possible that it wont work on computers without matlab because of that. I did my tests on a computer with a more recent version of matlab… I will look into this myself, but still I would like to know the type of dll I should be creating.

Thank you.


EDIT: The framework I mentioned is indeed needed. It is freely distributable, here it is:

Which instructions did you use ?
Ones I’ve seen turn out a .Net DLL which is a tad different

However in those they also show you can create a C shared library which might be a more standard DLL that can be used

Hi Julen,

I have been writing quite a few declares for Xojo on Windows lately and I am seeing the same problem that you are having with your supplied code. The error when compiling is:

An exception of class FunctionNotFoundException was not handled. The application must shut down.

Here is an article which goes through steps to create an external shared dll from the MATLAB compiler to create C/C++ shared libraries. Use MATLAB compiler to create C/C++ Shared libraries or DLL’s

I hope this helps.

Hi Eugene,

Sorry I didn’t reply before, I just saw your answer.

I had found that page before. It doesn’t help me much because I don’t know any C/C++. Not saying the information is not there, but right now I don’t have the time to dig it out. Thanks anyway.