SilverScreen Solid Modeler

The __cdecl calling convention

The __cdecl calling convention

Previous topic Next topic  

The __cdecl calling convention

Previous topic Next topic JavaScript is required for the print function  

SilverPlusEllipse

 

The __cdecl calling convention

 


The __cdecl calling convention is used for the SilverCExec function, and also for SilverC library functions, which are called via pointers passed to the DLL.  The calling function cleans up the stack Functions that use this calling convention require a function prototype. The following list shows the implementation of this calling convention.

 

 


Element

Implementation

Argument-passing order

Right to left

Argument-passing convention

By value, unless a pointer or reference type is passed

Stack-maintenance responsibility

Calling function pops the function arguments from the stack

Name-decoration convention

An underscore (_) is prefixed to the name. Therefore, the function declared as int func( int a, double b ) is decorated as follows: _func

Case-translation convention

None

 

 

Notes

The Visual C '/Gd' compiler options specifies __cdecl for all functions not explicitly declared with a different calling convention.

 

Note that although for __cdecl functions the C compiler generates a symbol that is prefixed with ‘_’, the linker, when exporting such a symbol from the DLL, strips the ‘_’ from the exported name.

 

You may use a function with a name other name than DllMain by using the /ENTRY: linker option; to keep things simple, we retain the DllMain convention.

 

SilverScreen is built using the _AFXDLL architecture, that is, it uses the MFC and C runtime DLL's, rather than statically linking them. The SilverC extension DLL may also use the MFC as well in a DLL, thus saving code. Beware... the standard run-time library calls in a SilverC extension library are actually implemented via call through a function pointer in the SSREX structure passed at initialization time.