Click here to Skip to main content
15,900,511 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Unresolved external symbol in a DLL Pin
Naveen15-Dec-08 0:51
Naveen15-Dec-08 0:51 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George15-Dec-08 1:16
George_George15-Dec-08 1:16 
GeneralRe: Unresolved external symbol in a DLL Pin
Naveen15-Dec-08 1:28
Naveen15-Dec-08 1:28 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George15-Dec-08 1:59
George_George15-Dec-08 1:59 
GeneralRe: Unresolved external symbol in a DLL Pin
Naveen15-Dec-08 2:13
Naveen15-Dec-08 2:13 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George15-Dec-08 2:49
George_George15-Dec-08 2:49 
GeneralRe: Unresolved external symbol in a DLL Pin
Naveen15-Dec-08 3:14
Naveen15-Dec-08 3:14 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George16-Dec-08 1:34
George_George16-Dec-08 1:34 
Thanks Naveen!

I have proved we could expose both class and global variable by DLL and using your mentioned elegant way. Smile | :)

But I am not 100% confident. Here is my code, could you have a code review please?

DLL Part:

// foo.h

#ifdef _DLLPROJ_
#define DLLEXP __declspec (dllexport)
#else 
#define DLLEXP __declspec (dllimport)
#endif

DLLEXP class CFoo
{
public:

	DLLEXP int foo1();

	DLLEXP int foo2();
};

DLLEXP class CFooImpl : CFoo
{
public:

	DLLEXP CFooImpl();

	DLLEXP int foo1();

	DLLEXP int foo2();
};

// dllmain.cpp

#include "foo.h"

CFooImpl::CFooImpl()
{
	return;
}

int CFooImpl::foo1()
{
	return 100;
}

int CFooImpl::foo2()
{
	return 200;
}

DLLEXP CFooImpl foo;


Hosting client part

// main.cpp

#include "foo.h"

DLLEXP CFooImpl foo;

int main()
{
	CFooImpl foo1;

	int i = foo.foo1();
	i = foo.foo2();

	return 0;
}


regards,
George
GeneralRe: Unresolved external symbol in a DLL Pin
Naveen16-Dec-08 2:16
Naveen16-Dec-08 2:16 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George18-Dec-08 0:21
George_George18-Dec-08 0:21 
GeneralRe: Unresolved external symbol in a DLL Pin
Stuart Dootson16-Dec-08 3:33
professionalStuart Dootson16-Dec-08 3:33 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George18-Dec-08 0:22
George_George18-Dec-08 0:22 
GeneralRe: Unresolved external symbol in a DLL Pin
Stuart Dootson18-Dec-08 0:36
professionalStuart Dootson18-Dec-08 0:36 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George18-Dec-08 1:25
George_George18-Dec-08 1:25 
GeneralRe: Unresolved external symbol in a DLL [modified] Pin
Stuart Dootson18-Dec-08 2:42
professionalStuart Dootson18-Dec-08 2:42 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George20-Dec-08 0:07
George_George20-Dec-08 0:07 
AnswerRe: Unresolved external symbol in a DLL Pin
Stuart Dootson15-Dec-08 12:38
professionalStuart Dootson15-Dec-08 12:38 
GeneralRe: Unresolved external symbol in a DLL Pin
George_George16-Dec-08 1:35
George_George16-Dec-08 1:35 
QuestionPropertySheet in a dialog Pin
Kiran Pinjala14-Dec-08 23:27
Kiran Pinjala14-Dec-08 23:27 
QuestionGet dependent Dll list Pin
MANISH RASTOGI14-Dec-08 23:22
MANISH RASTOGI14-Dec-08 23:22 
GeneralRe: Get dependent Dll list Pin
CPallini14-Dec-08 23:28
mveCPallini14-Dec-08 23:28 
AnswerRe: Get dependent Dll list Pin
Jijo.Raj14-Dec-08 23:38
Jijo.Raj14-Dec-08 23:38 
AnswerRe: Get dependent Dll list Pin
K. Sushilkumar17-Dec-08 1:41
K. Sushilkumar17-Dec-08 1:41 
QuestionPrivileges Using an Application Manifest Pin
MsmVc14-Dec-08 22:14
MsmVc14-Dec-08 22:14 
QuestionRe: Privileges Using an Application Manifest Pin
Mark Salsbery15-Dec-08 11:16
Mark Salsbery15-Dec-08 11:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.