From: Sean Larkin on
I created a shared C library using the deploytool, which I call from a C# project. I created this using MCR v77 and everything runs fine, i.e. I call the function mclInitializeApplication and then initialize the shared library and then call its functions.

I've recently upgraded to MATLAB 2010 and thus now use the MCR v713 to compile my shared library. I modified my C# source code that calls the shared library created in MATLAB to reflect the new version on the MCR. But when I try to initialize the MCR with the function mclInitializeApplication I get the following error:

Unable to find an entry point named 'mclInitializeApplication' in DLL 'mclmcrrt713.dll'.
at CSharpProject.MATLib.mclInitializeApplication(String options, Int32 count)

where CSharpProject is the name of my project and MATLib is a class that links the C# code to the MCR.

Here's how my call (or rather linking function prototype, as the call itself just uses this form) used to look when it worked with MCR v77:
[DllImport("mclmcrrt77.dll")]
internal static extern bool mclInitializeApplication(string options, Int32 count);

Now the call looks like this:
[DllImport("mclmcrrt713.dll")]
internal static extern bool mclInitializeApplication(string options, Int32 count);

As you can see the only change I made was to the version number of the dll I'm calling.

I did notice that MCR v713 has a header file mclmcrrt.h that v77 did not have, so perhaps that is causing the problem, but I don't know how to fix that issue. I also noticed in the mclmcr.h file that the function prototype has been changed to:
EXTERN_C bool mclInitializeApplication(const char** options, size_t count);

where in v77 it was:
EXTERN_C bool mclInitializeApplication(const char **options, int count);

Is the "size_t" significant? Or is there a new way to initialize the mcr in v713? Or should I be calling a different dll to initialize the MCR?
From: Sean Larkin on
"Sean Larkin" <slarkin71278(a)sbcglobal.net> wrote in message <i2kjq8$hea$1(a)fred.mathworks.com>...
> I created a shared C library using the deploytool, which I call from a C# project. I created this using MCR v77 and everything runs fine, i.e. I call the function mclInitializeApplication and then initialize the shared library and then call its functions.
>
> I've recently upgraded to MATLAB 2010 and thus now use the MCR v713 to compile my shared library. I modified my C# source code that calls the shared library created in MATLAB to reflect the new version on the MCR. But when I try to initialize the MCR with the function mclInitializeApplication I get the following error:
>
> Unable to find an entry point named 'mclInitializeApplication' in DLL 'mclmcrrt713.dll'.
> at CSharpProject.MATLib.mclInitializeApplication(String options, Int32 count)
>
> where CSharpProject is the name of my project and MATLib is a class that links the C# code to the MCR.
>
> Here's how my call (or rather linking function prototype, as the call itself just uses this form) used to look when it worked with MCR v77:
> [DllImport("mclmcrrt77.dll")]
> internal static extern bool mclInitializeApplication(string options, Int32 count);
>
> Now the call looks like this:
> [DllImport("mclmcrrt713.dll")]
> internal static extern bool mclInitializeApplication(string options, Int32 count);
>
> As you can see the only change I made was to the version number of the dll I'm calling.
>
> I did notice that MCR v713 has a header file mclmcrrt.h that v77 did not have, so perhaps that is causing the problem, but I don't know how to fix that issue. I also noticed in the mclmcr.h file that the function prototype has been changed to:
> EXTERN_C bool mclInitializeApplication(const char** options, size_t count);
>
> where in v77 it was:
> EXTERN_C bool mclInitializeApplication(const char **options, int count);
>
> Is the "size_t" significant? Or is there a new way to initialize the mcr in v713? Or should I be calling a different dll to initialize the MCR?

By way of MATLAB's technical support team I was made aware of a workaround for this problem. The function mclInitiaizeApplication is no longer supported for calling from C# .NET applications. The function to call is "mclInitializeApplication_proxy". This solved my problem, but it makes me wonder if this would be a problem when calling a C shared library from other languages such as C++ or java.