Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Calling a matlab shared library compiled in a C++ project from VBA

$
0
0
"Fabian " <fabian.dekeyn@efa.eu> wrote in message <ko9ohc$mni$1@newscl01ah.mathworks.com>...
> Hi,
>
> I have done the following:
>
> 1 - Create a matlab shared library
> 2 - Call it from a C++ project. It works.
> 3 - Creating a C++ dll that I call from an xls macro.
> 4 - it works when no call is done to any matlab subroutine.
> 5 - it fails when a call is done to a matlab subroutine (with different error messages : overflow or file not found. Overflow when the following piece of code is activated:
> if (!mclInitializeApplication(NULL,0))
> {
> std::cerr << "Could not initialize the application properly."
> << std::endl;
> return -1;
> }
> File not found when the following one is:
>
> if (!mclInitializeApplication(NULL,0))
> {
> std::cerr << "Could not initialize the application properly."
> << std::endl;
> return -1;
> }
>
>
>
> if(!AdditionLibInitialize())
> {
> std::cerr << "Could not initialize the library properly" << std::cerr;
> return -1;
> }
>
> Can anyone give me a hint to solve this out ?
>
> Thanks

Just to clarify, you created a Matlab shared library of m-files which you then call from a C++ project. You compile and run your C++ project in the IDE or command line and your program runs just fine?

It's when you compiled it into a .dll and tried wrapping it with VBA is when you get these errors. Am I following you correctly?

Or, did you compile the Matlab m-files into some sort of .dll themselves that you are calling from C++?

Or, did create some C++ wrappers for them, although I am not sure how that would be done?

My first thought is that you are trying to do this to get around using or not having the Matlab compiler with the Matlab runtime engine. I also wonder if the excel add on toolbox would roughly eliminate the need to do anything in C++, unless your code is that complex that you needed the raw speed.

Alot of this is new to me so I am trying to figure out better what you actually did?

Viewing all articles
Browse latest Browse all 19628

Trending Articles