I have created CMyClass,in which defined one method CallMe().when I build this project MyProject.dll is generated. Now in some another project, I want to call CallMe of CMyClass . can anybody tell me how to do it ? Thanks in advance....
A:
Assuming this is in visual studio..
You need to add a reference to your library from your project, once you have done this you can create an instance of your class and call your method, providing that the class and method is public (or protected if deriving from).
You should be able to do something like :
Yournamespace.CMyClass myClass = new Yournamespace.CMyClass();
myClass.CallMe();
Richard Friend
2010-06-10 09:33:38
A:
You should add a reference to the MyProject.dll to your new project,then, create an object of CMyClass: CMyClass mClass=new CMyClass(); mClass.CallMe();
- Be sure that the CMyClass class is a public class and the Callme() method is also public
Hadad
2010-06-10 09:34:03
A:
Edit: In C++ just #include the header file and include the .lib file while linking. Or call LoadLibrary to load the DLL. This MSDN page will give you more details.
This is assuming it's not a COM DLL, if it is, things would be somewhat different.
ho1
2010-06-10 09:34:21
Sorry....I m using c++.One thing that i m not getting that how I will bw able to create object of some class which is defined in another project.
bharat
2010-06-10 10:03:39
@bharat: Just #include the header file and include the .lib file while linking.
ho1
2010-06-10 10:08:14
@bharat: amended my answer
ho1
2010-06-10 10:11:09