By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

c++ DLL get parameters

P: 1
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
Jun 7 '07 #1
Share this Question
Share on Google+
2 Replies


100+
P: 256
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

I'm not sure if I understand the explanation of your setup. You have an application (that you built) which uses a dll (which you also built), and inside the dll is a class? And you want to know how your application can supply data to the class inside the dll? -- I assume these are true in my response

A dll is just a library that the system loads for you at runtime. You just use what's in it. So if the dll holds a class you just use the class. The way you supply parameters to the class from the dll depends on the methods supplied by the class. If your class does not provide methods accept the data you want to send you will have to add methods to your class.
Jun 7 '07 #2

weaknessforcats
Expert Mod 5K+
P: 9,197
Upon running it basically creates an application class, then creates a dialog box. This piece works!
If I understand you correctly, the application class and the dialog are working from inside the DLL. Yes?

If so, just write a function to acquire the arguments you need. Make sure it is extern "C" to turn off the mangler. Have that function locate your apoplication class obejct and call methods on it to set the arguments into the application.
Jun 7 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.