none
Matlab MEX: MFC DLL or Win32 DLL RRS feed

  • Question

  •  

    Hi,

    I am trying to use VC 6 to compile c files to matlab mex (a kind of DLL). VC 6 gives me two type of dlls:MFC and Win32.

    i tried both. they both works fine on my computer (i compiled them on my computer).

    then on another mathine, the matlab (thus some matlab lib files i included in the project) is in aother directory (different from mine). Now the Win32 type mex file works fine, but the MFC type mex file does not work.

    Does this have something to do with the settings of the linker or compiler?

    my codes are exactly the same for Win32 DLL and MFC DLL.

    can anybody give me some clue where i should pay attention to in codeing the MFC DLL?

    thank you very much for the help.

    Qi

    Monday, March 5, 2007 3:05 AM

Answers

  •  zhang258 wrote:
     

    [...]

    can anybody give me some clue where i should pay attention to in codeing the MFC DLL?

    [...]

    In my opinion, in case of MFC projects you should pay attention to additional DLL files which must be installed on target machine (e.g. MFC42.DLL).

     

    In order to determine which exactly MFC*.DLL are required, you can try the Depends.EXE tool from a subdirectory of Visual Studio. You can simply copy DLL files from your computer to the target machine, in the same directory with your Matlab MEX DLL. (Not applicable for newer Visual Studio).

     

    Alternatively, simply change the type of your DLL: go to project settings --> General --> Microsoft Foundation Classes and select "Use MFC in a Static Library". In this case the code which belongs to MFC will be inserted into your DLL and you do not more require external MFC DLLs. Then rebuild your project.

     

    I hope this helps.

    Monday, March 5, 2007 1:02 PM