Article ID: 140485 - Last Review: June 2, 2005 - Revision: 3.0 How to export PASCAL-like symbols in a 32-bit dll file in Visual C++
This article was previously published under Q140485 On This PageSUMMARY There is no _pascal keyword in the 32-bit editions of
Visual C++. Instead the Windef.h header file has PASCAL defined as __stdcall.
This creates the correct style calling convention for the function (the called
function cleans up the stack) but decorates the function name differently. So,
when __declspec(dllexport) is used (in a .dll file, for example), the decorated
name is exported instead of the desired PASCAL style name, which is undecorated
and all uppercase. MORE INFORMATION PASCAL name decoration is simply the undecorated symbol
name in uppercase letters. __stdcall name decoration prefixes the symbol name
with an underscore (_) and appends the symbol with an at sign (@) character
followed by the number of bytes in the argument list (the required stack
space). So, the function when declared as: To get the decorated name set the Generate Mapfile option in the Linker General category setting. Use of __declspec(dllexport) does the following:
Because there is no way to override who does the stack clean up, you must use __stdcall. To undecorate names with __stdcall, you must specify them by using aliases in the EXPORTS section of the .def file. This is shown below for the following function declaration: ReferencesFor more information, query the MSDN compact disc using these keywords:
VB alias DLL
NOTE: A very good discussion (with example code) of calling a C
.dll file from Visual Basic can be found in the file Vb4dll.txt in the Visual
Basic directory. If you can not locate the Vb4dll.txt file, please see the
following article in the Microsoft Knowledge Base: 150705
(http://support.microsoft.com/kb/150705/EN-US/
)
Using VB4DLL.TXT File to Develop DLLs for Visual Basic APPLIES TO
| Other Resources Other Support Sites
CommunityArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top