| | |
Console application and MFC-DLL application
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Hi all,
For later use I want to create dll file, internally using MFC. I used MFC because it is so easy to do my job. So used the MFC-DLL Visual C++ project and code my project. Its ok.
Later add another Console Application which support MFC as well. I want to use it to send data to the dll externally. Simply pass a std::string to dll, and there use that string for processing.
My question is how can I connect those two projects together. How to send data to dll application from the console application.
For later use I want to create dll file, internally using MFC. I used MFC because it is so easy to do my job. So used the MFC-DLL Visual C++ project and code my project. Its ok.
Later add another Console Application which support MFC as well. I want to use it to send data to the dll externally. Simply pass a std::string to dll, and there use that string for processing.
My question is how can I connect those two projects together. How to send data to dll application from the console application.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
DLLs are much like normal static libraries. Create a header file with the dll functions you have exported and include it in your console project, then add the .lib file that the compiler created for the dll in the console project just like you would any other project.
I use a conditional compile preprocessor directives in the header file so that it can be included in both the dll build and the console application build
I use a conditional compile preprocessor directives in the header file so that it can be included in both the dll build and the console application build
C++ Syntax (Toggle Plain Text)
// header file #if defined(DLL_BUILD) #define MYAPI __dllexport #else #define MYAPI __dllimport #endif void MYAPI foo(std::string& datastr);
Last edited by Ancient Dragon; Dec 14th, 2007 at 6:28 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
•
•
DLLs are much like normal static libraries. Create a header file with the dll functions you have exported and include it in your console project, then add the .lib file that the compiler created for the dll in the console project just like you would any other project.
I use a conditional compile preprocessor directives in the header file so that it can be included in both the dll build and the console application build
C++ Syntax (Toggle Plain Text)
// header file #if defined(DLL_BUILD) #define MYAPI __dllexport #else #define MYAPI __dllimport #endif void MYAPI foo(std::string& datastr);
I've read few articles and get really mess with this header file and stuff. I think it is better to find a complete document on dll and read it first. I collect a document and going to read it tonight.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
![]() |
Similar Threads
- About console command line switches.... (Windows Software)
- Help Me Change a VC++6 Project Name (C++)
- Internet Explorer-OUT OF ORDER + More (Viruses, Spyware and other Nasties)
- vc++ mfc-i can't make getline work with a string for file input (C++)
- Using MFC in a Static Library (C++)
Other Threads in the C++ Forum
- Previous Thread: C++ Real world interfaces?
- Next Thread: Serial Communication C++
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






