Exporting class from a DLL

nitinkale used Ask the Experts™
I have a CGraph class, which is use in a MDI application  to draw line graph on given device context. I use this class by keeping its object in a Document class and taking its pointer in View class and calling CGraph class's functions.
Now I want to make DLL of this CGraph class say CGraphDll, which I will be using to draw graphs. So can I export the CGraph class which is in CGraphDll and get its object in document class, so that can get new object of it whenever i create new document? Or I have to make a new class in the CGraphDll which should handle the multiple instances of the CGraph class?
If my explaination is not clear please ask. I am not able to start with how do I go about this as I am doing DLL part for the first time.

Thanks in advance,
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Yes you can.  You instantiate a new object of type DLLName.CGraphClass.  I don't know what language you are using so I can't be more specific.

In VB, you would wrap the class up in a DLL, compile it, set a reference to it in your application, then do something like:

dim oGraphClass as DLLName.CGraph
set oGraphClass = new DLLName.CGraphClass.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Recommendation: Delete

Please leave any comments here within the next seven days.
EE Cleanup Volunteer
I disagree.  This is the technique one would use.  A VB example was provided and is easy enough to modify into whatever language you desire.
I won't argue - that was a bit of a judgement call anyway - the guy seemed to be using MFC, but advice expressed in VB for a self-confessed first timer is probably also useful.
Thanks PashaMod and thanks to DominicCronin also for the cleanup work!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial