-4

How do I get Matlab R2007b to work with Visual Studio c++ 6.0 in (Win 7.0 64 bit OS) ?

I get the following error:

    >> loadlibrary dog.dll dog.h

Warning: Shared libraries are not supported on this platform.  
Functions that do not have a mexFunction signature may have unpredictable results.

    > In loadlibrary at 54

    ??? Error using ==> loadlibrary at 209
    LCC was not found at C:\Program Files\MATLAB\R2007b\sys\lcc\bin\lcc.exe.
Amro
  • 123,847
  • 25
  • 243
  • 454
jdl
  • 6,151
  • 19
  • 83
  • 132
  • VS C++ 6.0 with matlab R2007b? – jdl Oct 05 '11 at 01:14
  • Have you read the [MEX-files Guide](http://www.mathworks.com/support/tech-notes/1600/1605.html)? What happens when you follow the instructions with the ["Hello, World!" MEX-file](http://www.mathworks.com/support/tech-notes/1600/1605.html#example1)? What are the `dog.dll` and `dog.h` files? And why are you using a 13-year old C++ compiler? The Windows 7 SDK includes a free version of the latest version of the compiler (not the IDE). – André Caron Oct 05 '11 at 03:46
  • DLL files are indeed allow you to import code at runtime. However, there is no guarantee that you can safely inject any DLL in any application with "ease". There are constraints to respect. You have to make sure that C++ runtimes on both side are compatible, etc. And MATLAB expects your DLL to provide a function named `mexFunction()`, which should have a particular signature. This is called a *contract*. Showing us what you're really trying to do will help us determine if you're respecting the contract MATLAB is expecting of your DLLs. – André Caron Oct 05 '11 at 14:16
  • Moreover, technology evolves and there is no guarantee that techniques that worked "years ago" still work today. – André Caron Oct 05 '11 at 14:18
  • @AndréCaron: MEX-functions and `loadlibrary`-DLLs are not the same thing.. – Amro Oct 19 '11 at 08:50

1 Answers1

0

Run mex -setup first and select Visual Studio.

Everything will be clear if you read the MATLAB help. See http://www.mathworks.co.uk/help/techdoc/matlab_external/f43202.html and http://www.mathworks.co.uk/support/compilers/release2007b/

Nzbuu
  • 5,241
  • 1
  • 29
  • 51