| | |
Building DLLs in VC++
![]() |
•
•
Join Date: Sep 2005
Posts: 4
Reputation:
Solved Threads: 0
hey all, I just joined this community. I have been programming quite a bit in C/C++, however, this is the first time i am doing something like this. I have the Microsoft VC++ 6 package. The idea is to use the functions i have already written in the past( a lot of them ), in a current MATLAB project. The solution that i can think of is to convert the functions and the libraries into a DLL so that i can use loadlibrary in MATLAB and call them out. however, i cant seem to make DLL files. I have done some reading, but it is not helping. Can anyone help me out with this. The problem is to build DLLs in VC++ and then call them using MATLAB. In case there is a better method to call the C++ functions in MATLAB, i am open to that too. I just need to get some stuff working in MATLAB without having t recode it, since recoding will take me a HELL lot of time. Help me out folks ... Thanks
Cheers
Cheers
•
•
Join Date: Sep 2005
Posts: 4
Reputation:
Solved Threads: 0
Yes that could work too, i may get some hints based on that. I am trying another approach now which is very lenghty and "dirty" to say the least. I am trying to get executables. I am making executables of all the functions, due to which i am loosing the nice class structure i had built. I will then be calling these executables in MATLAB, using the system command.
However, if you can get me to make a DLL to be loaded in MATLAB, it would be great.
Thanks a lot
Cheers
However, if you can get me to make a DLL to be loaded in MATLAB, it would be great.
Thanks a lot
Cheers
in VC++ 6.0 IDE create a "win32 Dynamic-Link Library" project. Step 1 of the wizard has 3 radiao buttons select "a DLL project that exports some symbols" then press Finish button. The wizard will generate the DLL project. Look at the *.cpp and *.h files. They will show you how to add your own functions and how to "export" them so that they can be used by other applications. Just copy-past the functions or files into that project, export them as illusterated.
•
•
Join Date: Sep 2005
Posts: 4
Reputation:
Solved Threads: 0
Thanks Proliant .. appreciate it ..
Ancient.... i have already done that. It makes my DLLs.. but the problem is loading them into MATLAB. When i load them into MATLAB, it does not like it. It says, that all the functions mentioned in the header are missing. I am trying to get around that. Got any ideas ?
Cheers
Ancient.... i have already done that. It makes my DLLs.. but the problem is loading them into MATLAB. When i load them into MATLAB, it does not like it. It says, that all the functions mentioned in the header are missing. I am trying to get around that. Got any ideas ?
Cheers
sounds like the function names in the dll have been mangled, so mathlib doesn't know how to handle that. In the dll, use extern "C" if you don't need c++ classes to keep the compiler from mangling the names.
DllMain() is called by the os, not directly by using applications. Its sortof like a c++ class constructor/destructor in that it is called then the DLL is loaded into memory and again just before exit.
C++ Syntax (Toggle Plain Text)
extern "C" { void _dllexport foo(); }
DllMain() is called by the os, not directly by using applications. Its sortof like a c++ class constructor/destructor in that it is called then the DLL is loaded into memory and again just before exit.
![]() |
Other Threads in the C++ Forum
- Previous Thread: word counter
- Next Thread: C++ if statement help
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ char class classes code coding compaitibility compile console conversion count delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error factorial file floatingpoint forms fstream function functions game givemetehcodez graph guessing gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker loop looping loops map math matrix maze memory multiple net news node oop output parameter payment pointer problem program programming project projectassignmenthelp protection python random rank read recursion reference rpg skills string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






