PDA

View Full Version : c++ DLL get parameters


ill_comms
06-07-2007, 01:21 AM
Hi All,

first time building a DLL not to mention C++ program and I'm having a little trouble trying to get the parameters passed to it.

I'm using VC++ 6.0. I created this via a 'Regular DLL using shared MFC DLL'

Upon running it basically creates an application class, then creates a dialog box. This piece works!

Now, I need to pass it three parameters to use though out the program, do I create a new method within the application class to grab these values? (If so can someone give me some example on what I need in this method) Or have I gone the wrong way in trying to build this? All examples I have read are fairly simple DLLs with functions, mine is based on classes.

Any help would be greatly appreciated
Hayden

Reedbeta
06-07-2007, 09:37 AM
Normally a DLL does not do anything autonomously, but just contains a collection of routines and classes to be called upon by the main application. So, the main application should call some function of the DLL, passing whatever parameters are needed, or the application should instantiate some class, in which case it can pass parameters to the constructor.

If you are creating your objects from the DLL's entry point (LibMain or DllMain), you should move those to a separate initilization function that is called from the application.