3D PLM Enterprise Architecture

Middleware Abstraction - Object Modeler

About __stdcall

Making your interface methods comply with Automation
Quick Reference

Abstract

This article explains the __stdcall statement you need to insert in your interface method signatures. It includes the following section:


What Is __stdcall?

__stdcall is a Microsoft specific extension to the C++ compiler. It is set to NULL with UNIX, and is there useless. __stdcall is required in the method signature for Automation and invocation from Visual Basic.

A function or method with __stdcall in its signature uses the Pascal calling convention, which requests the called function to remove the parameters from the stack before returning to the caller. Otherwise, the C/C++ calling convention is used, which requests the caller to clean up the parameter stack instead of the called method.

Note that __stdcall must be included in the interface (.idl) and in the header (.h) files, but can be omitted in the source (.cpp) file. This is the convention used in these articles.

The IUnknown interface gives an example of __stdcall usage in the QueryInterface method signature:

virtual HRESULT __stdcall QueryInterface(const IID & iid, void ** ppv) = 0;

[Top]


History

Version: 1 [Jan 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.