From: Philip Borghesani on
> Using Dependency Walker (http://www.dependencywalker.com/), I have
> verified that the DLL does in fact contain the maintDLL() function.
>

The function is declared _stdcall normally _stdcall functions are exported with a trailing @number.
Is the number present in the dependency walker output? Can you post the dependency walker output?

The number is the sum of the bytes in the inputs to the function and if the prototype used by loadlibrary is
not correct then a different number will be calculated and the function will not be found.

It should be possible to use the profile option in dependency walker (you may need to download a new version)
to see what functions loadlibrary is looking for.

Phil


From: Mark Patterson on
"Philip Borghesani" <philip_borghesani(a)mathworks.spam> wrote in message <i0ln6o$g6d$1(a)fred.mathworks.com>...
> The function is declared _stdcall normally _stdcall functions are exported with a trailing @number.
> Is the number present in the dependency walker output? Can you post the dependency walker output?
>
> The number is the sum of the bytes in the inputs to the function and if the prototype used by loadlibrary is
> not correct then a different number will be calculated and the function will not be found.
>
> It should be possible to use the profile option in dependency walker (you may need to download a new version)
> to see what functions loadlibrary is looking for.
>
> Phil

Hi Phil,

The function appears in Dependency Walker with a leading underscore and a trailing @20, which is, I believe, what is expected for the _stdcall calling convention (this is based on my recent Googling, I've never looked into calling conventions before). I noticed that the mfile prototype generated by loadlibrary had 'stdcall' in one of the fields of the data structure (I don't have the file with me right now to give you the exact details), suggesting the MATLAB detected this and expected to be able to handle it. My understanding is that MATLAB can load _stdcall functions. I did experiment with changing the prototype in the header file to have an incorrect number of bytes and the error given by loadlibrary was unchanged.

Do you know if MATLAB has issues with _stdcall functions? You you need to do anything in particular to load _stdcall functions?

-Mark