0

I have the following problem: I have a 64 bit version of matlab 2011b. I need to call some functions from a DLL. This has been working some time ago with the prof version of visual studio 2010.

Now I want to get it running with the express version. I therefore installed the visual Studio C++ 2010 Express and the Win SDK 7.1. Now I give matlab the command mex -setup and select the VC++ compiler. All right!

If I want to load the dll itself with loadlibrary, I get tons of errors. Something like: Building libFramework_thunk_pcwin64 failed. Compiler output is:

cl -I"C:\MATLAB\R2011b\extern\include"   /W3  /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0  /nologo  -I"U:\Framework\Framework\so" -I"U:\Framework\Framework\so" "libFramework_thunk_pcwin64.c" -LD -Fe"libFramework_thunk_pcwin64.dll" libFramework_thunk_pcwin64.c
Bibliothek "libFramework_thunk_pcwin64.lib" und Objekt "libFramework_thunk_pcwin64.exp" werden erstellt.
LIBCMT.lib(dllcrt0.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__GetCurrentThreadId@0" in Funktion "__CRT_INIT@12".
LIBCMT.lib(tidtable.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp__GetCurrentThreadId@0".
LIBCMT.lib(gs_support.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp__GetCurrentThreadId@0".
LIBCMT.lib(onexit.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp__DecodePointer@4".
LIBCMT.lib(crtmboxw.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__DecodePointer@4" in Funktion "___crtMessageBoxW".

<snip>

libFramework_thunk_pcwin64.dll : fatal error LNK1120: 65 nicht aufgelöste externe Verweise.

Error in load_Framework (line 4)
    loadlibrary 'libFramework' 'Shaddower_C.h'

Unfortunately these errors are in German as I use german software. The (looslely) translation is, that there are links to non-solvable external symbols in different functions. If you know how to change the language to English, I can give you the exact output.

As I googled, I found out, that all functions I tried were from standard libraries, I just found some of the rundll32.dll but maybe there are other links as well.

In fact it seems, that the compiler is not able to access the default windows dll (or the sdk).

Can you tell me what's going wrong here?

PS: For those who understand the German language see http://www.gomatlab.de/viewtopic,p,91154.html#91154 I posted on a pure matlab forum fist, but as I guess it's a VC++ problem I also posted here.

Amro
  • 123,847
  • 25
  • 243
  • 454
Christian Wolf
  • 1,187
  • 1
  • 12
  • 33
  • Did you install the 64-bit SDK for VS2010 express? It isn't a default install. http://stackoverflow.com/questions/1865069/how-to-compile-a-64-bit-application-using-visual-c-2010-express You shouldn't have to do steps 2-3 unless you are using a VS project file. – Chris May 14 '12 at 19:13
  • I don't understand. The link relates to the compilation of an app from within VC2010 directly. I wand to compile via the Matlab command mex. This calls the compiler `cl` and Linker `link` to do the things. I do never open VS2010 directly nor did I now how to do anything with a VS project file. So please be a bit more concrete what you want me to do. Thanks – Christian Wolf May 15 '12 at 11:52
  • Sorry I thought I was. Is your Matlab a 64bit variant? If so, have you installed the 64bit SDK for VS2010 (step1 in that link)? This is required even if you are not building from within VS. You cannot use a 32bit compiler & SDK if you are using 64bit Matlab. When you invoke mex, it will try to link 64bit code with 32bit libraries and fail. – Chris May 15 '12 at 15:33
  • Yes, it was the correct version of VS2010 – Christian Wolf May 18 '12 at 10:46

1 Answers1

0

I found out, that I had some packages about VS2010 Redistributable installed. I deleted them and the installed VS2010 and the SDK. After reinstalling the SDK all went correct.

Thanks

Christian Wolf
  • 1,187
  • 1
  • 12
  • 33