+ Reply to Thread
Results 1 to 2 of 2

Thread: What is the difference between cdecl and stdcall?

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    48

    What is the difference between cdecl and stdcall?

    What is the difference between _cdecl and __stdcall?

    Which one should I prefer?

    Is there any performance penalty with any one of these?

    Please guide me. I want to use in my DLL exports.

  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    26
    I will give you practical example of using _cdecl and __stdcall in DLL to export functions:

    Code:
    #ifdef __cplusplus
    extern "C"
    {
    
    __declspec(dllexport) void DefaultSetting()
    {
    
    }
    
    	
    __declspec(dllexport) void _cdecl ExplicitCDecl()
    {
    
    }
    
    __declspec(dllexport) void __stdcall ExplicitStdCall()
    {
    
    }
    
    }
    #endif
    In above example:

    a. DefaultSetting uses the default setting of the VC++ compiler which is _cdecl.
    b. ExplicitCDecl uses the _cdecl explicitly.
    c. ExplicitStdCall uses the __stdcall explicitly.

    Exports from the dependency Walker:
    a. DefaultSetting
    b. ExplicitCDecl
    c. _ExplicitStdCall@0

    Now, you decide what is best fit for you.

    For more information, visit:
    http://msdn.microsoft.com/en-us/libr...=vs.71%29.aspx
    http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts