Click here to Skip to main content
15,886,864 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello,

I use LoadLibrary to call functions exported in a DLL (defined in *.def file), however I want to export an entire class through LoadLibrary (explicit linking). How can I achieve this. Please help me.

Thanks in advance!
Posted
Updated 25-May-10 22:09pm
v2

i got it ,

it can be done by making class function virtual,

and keeping class header file in exe file where i want class
 
Share this answer
 
Comments
[no name] 28-Jun-11 2:45am    
You are trying to create own COM.
You can't import classes if you use explicit linking.
What are you trying to achieve exactly ?
 
Share this answer
 
Try using MSDN for your research; see here[^] for a full discussion on building export libraries.
 
Share this answer
 
i want to Create a Object of class which is in dll.

i can do it with implicit linking.

now i want to do it through explicit linking i.e. using function

LoadLibrary . when i try to use it i get linking error.

e.g.

HMODULE h = LoadLibrary("path\\dll_name.dll";);

class_name * ptr = (class_name *)GetProcAddress(h,"class_name");

ptr->function_name();

//class declearation is in header file
//here i get linking error as linker will not get function defination

i want to create a object of a class which is in dll.

am i going right ? if not is there any way to do it ?

thanks.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900