Click here to Skip to main content
16,014,662 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPolyline Editor in Open Gl Pin
csp200512-Sep-04 10:24
csp200512-Sep-04 10:24 
GeneralSegmentation fault?! Pin
Whiphub12-Sep-04 9:39
Whiphub12-Sep-04 9:39 
GeneralRe: Segmentation fault?! Pin
Antti Keskinen12-Sep-04 10:44
Antti Keskinen12-Sep-04 10:44 
GeneralSwitching mainframe menu (solution) Pin
Ravi Bhavnani12-Sep-04 8:23
professionalRavi Bhavnani12-Sep-04 8:23 
GeneralRe: Switching mainframe menu (solution) Pin
KaЯl13-Sep-04 3:55
KaЯl13-Sep-04 3:55 
QuestionHOw to convert from EMF to SWF. Pin
Azghar Hussain12-Sep-04 7:49
professionalAzghar Hussain12-Sep-04 7:49 
AnswerRe: HOw to convert from EMF to SWF. Pin
Christian Graus12-Sep-04 11:52
protectorChristian Graus12-Sep-04 11:52 
QuestionLink/C-calling convention ? Pin
0v3rloader12-Sep-04 6:46
0v3rloader12-Sep-04 6:46 
Hello,

I have a tricky situation happening in an app which loads a DLL and then tries to retrieve some procedure's addresses. Consider the following code:

void CDesktopPositionerDlg::OnCapture() 
{
	DFUNC_DEF(CDesktopPositionerDlg::OnCapture);
	BOOL (__stdcall *lpSetup)();
	BOOL bRetVal;
	//!CODE_START--->
	bRetVal = theApp.m_hModule != NULL;
	if(!bRetVal)
		goto loc_ret;
	// inform user
	lpSetup = ::GetProcAddress(theApp.m_hModule, "Setup");
	bRetVal = lpSetup != NULL;
	if(!bRetVal)
	{
		DTRACE(DSTR("Could not retrieve dll function address (err.#%d)", ::GetLastError()));
		goto loc_ret;
	}
	// call function now
	(*lpSetup)();
	.
	:
	.
// return location
loc_ret:
	DFUNC_RET2(bRetVal != FALSE, "Mouse hook not setup!", "Mouse hook successfully setup");
}


Now notice the call to ::GetProcAddress. If you change the name of the setup function to _Setup@0, which is the name defined in the .LIB file, all is fine and the hook is successfully setup.

What I would like to know is the linker option (or C calling convention) I have to adopt in order to prevent such situations from happening.

As always, all comments are welcome.

David
AnswerRe: Link/C-calling convention ? Pin
Antti Keskinen12-Sep-04 9:38
Antti Keskinen12-Sep-04 9:38 
GeneralRe: Link/C-calling convention ? Pin
0v3rloader12-Sep-04 22:59
0v3rloader12-Sep-04 22:59 
GeneralRe: Link/C-calling convention ? Pin
Antti Keskinen13-Sep-04 4:15
Antti Keskinen13-Sep-04 4:15 
GeneralRe: Link/C-calling convention ? Pin
0v3rloader14-Sep-04 1:47
0v3rloader14-Sep-04 1:47 
GeneralEnvironment macro Pin
Rome Singh12-Sep-04 6:31
Rome Singh12-Sep-04 6:31 
GeneralRe: Environment macro Pin
Andrew Walker12-Sep-04 14:46
Andrew Walker12-Sep-04 14:46 
GeneralRe: Environment macro Pin
Rome Singh13-Sep-04 5:12
Rome Singh13-Sep-04 5:12 
GeneralRe: Environment macro Pin
Andrew Walker13-Sep-04 12:52
Andrew Walker13-Sep-04 12:52 
QuestionWarning: no message line prompt for ID *???? Pin
jettocrack12-Sep-04 6:13
jettocrack12-Sep-04 6:13 
AnswerRe: Warning: no message line prompt for ID *???? Pin
Ravi Bhavnani12-Sep-04 7:13
professionalRavi Bhavnani12-Sep-04 7:13 
GeneralProblem Regarding Tree in DOTNET Pin
eshban28412-Sep-04 6:08
eshban28412-Sep-04 6:08 
GeneralRe: Problem Regarding Tree in DOTNET Pin
Antti Keskinen12-Sep-04 10:12
Antti Keskinen12-Sep-04 10:12 
GeneralDouble buffering in MFC Pin
amigaguy12-Sep-04 6:07
amigaguy12-Sep-04 6:07 
GeneralRe: Double buffering in MFC Pin
Antti Keskinen12-Sep-04 10:33
Antti Keskinen12-Sep-04 10:33 
GeneralRe: Double buffering in MFC Pin
Anonymous12-Sep-04 11:50
Anonymous12-Sep-04 11:50 
GeneralCDaoDatabase connection string in Windows XP Pin
olis12-Sep-04 5:36
olis12-Sep-04 5:36 
GeneralProcess help Pin
swarup12-Sep-04 4:40
swarup12-Sep-04 4:40 

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.