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

C / C++ / MFC

 
GeneralRe: Hook Keyboard Pin
Joan M27-Apr-03 22:44
professionalJoan M27-Apr-03 22:44 
GeneralFiles saved using CFileDialog Pin
dandy7727-Apr-03 16:57
dandy7727-Apr-03 16:57 
GeneralRe: Files saved using CFileDialog Pin
Dave Bryant27-Apr-03 17:40
Dave Bryant27-Apr-03 17:40 
GeneralRe: Files saved using CFileDialog Pin
dandy7727-Apr-03 18:21
dandy7727-Apr-03 18:21 
GeneralCalling C++ functions from C Pin
Stormwind27-Apr-03 16:55
Stormwind27-Apr-03 16:55 
GeneralRe: Calling C++ functions from C Pin
Tibor Blazko27-Apr-03 19:20
Tibor Blazko27-Apr-03 19:20 
GeneralRe: Calling C++ functions from C Pin
Stormwind27-Apr-03 19:31
Stormwind27-Apr-03 19:31 
GeneralRe: Calling C++ functions from C Pin
Mike Dimmick27-Apr-03 23:42
Mike Dimmick27-Apr-03 23:42 
It's often a good idea to be specific about the calling convention when exporting from a DLL; if the client program is compiled with a different default convention (using the /Gd, /Gr or /Gz switches) from your DLL it either won't link correctly or will potentially crash at runtime, due to erroneous stack manipulations.

__stdcall is marginally smaller (typically one ADD instruction) at the call site than __cdecl, but __cdecl can handle variable argument lists and is marginally smaller in the function implementation. The ADD instruction is used to reset the stack pointer after the call back to where it was before the compiler started PUSHing arguments. More info in John Robbins' excellent Debugging Applications books (I just bought the most recent one, Debugging Applications for Microsoft .NET and Microsoft Windows - there's a mouthful).

This only applies to desktop Win32 running on IA32 processors; Windows CE on IA32 always uses __cdecl, while other processors only have a single calling convention. Most RISC processors use a calling convention sort of like __cdecl but with the first n arguments passed in registers. This is also true of AMD64 (first 4 arguments passed in RCX, RDX, R8, R9 or XMM0-3 if floating point) and IA64 (first 8 arguments passed in the rotating portion of the register file).

[Yes, I know the processor names look a little unfamiliar; specifying 'x86' isn't very helpful any more because 64-bit 'x86-64' code works differently. AMD now wish Opteron/Athlon64-compatible code to be known as AMD64.]

--
Mike Dimmick
GeneralRe: Calling C++ functions from C Pin
Stormwind28-Apr-03 16:15
Stormwind28-Apr-03 16:15 
GeneralMDI Child Windows Help Pin
Steven M Hunt27-Apr-03 12:41
Steven M Hunt27-Apr-03 12:41 
GeneralRe: MDI Child Windows Help Pin
Neville Franks28-Apr-03 0:18
Neville Franks28-Apr-03 0:18 
GeneralRe: MDI Child Windows Help Pin
Hans Dietrich28-Apr-03 0:27
mentorHans Dietrich28-Apr-03 0:27 
GeneralProblem with linking Pin
sjcomp27-Apr-03 10:35
sjcomp27-Apr-03 10:35 
GeneralRe: Problem with linking Pin
Dave Bryant27-Apr-03 11:01
Dave Bryant27-Apr-03 11:01 
GeneralRe: Problem with linking Pin
sjcomp27-Apr-03 12:35
sjcomp27-Apr-03 12:35 
General3D perspective: zoom to extent Pin
Bartosz Bien27-Apr-03 10:10
Bartosz Bien27-Apr-03 10:10 
GeneralHelp Pin
th3kill3r27-Apr-03 7:16
th3kill3r27-Apr-03 7:16 
GeneralRe: Help Pin
th3kill3r27-Apr-03 7:17
th3kill3r27-Apr-03 7:17 
GeneralRe: Help Pin
Nish Nishant27-Apr-03 7:27
sitebuilderNish Nishant27-Apr-03 7:27 
GeneralRe: Help Pin
Kuniva27-Apr-03 7:46
Kuniva27-Apr-03 7:46 
GeneralRe: Help Pin
Anonymous28-Apr-03 11:56
Anonymous28-Apr-03 11:56 
GeneralRe: Help Pin
Kuniva29-Apr-03 4:49
Kuniva29-Apr-03 4:49 
GeneralSSL - i don't fully get the concept Pin
Kuniva27-Apr-03 7:15
Kuniva27-Apr-03 7:15 
GeneralRe: SSL - i don't fully get the concept Pin
Nish Nishant27-Apr-03 7:31
sitebuilderNish Nishant27-Apr-03 7:31 
GeneralRe: SSL - i don't fully get the concept Pin
Kuniva27-Apr-03 7:42
Kuniva27-Apr-03 7:42 

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.