Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:47:26+00:00 2026-06-01T02:47:26+00:00

I have been doing some x86 programming in Windows with NASM and I have

  • 0

I have been doing some x86 programming in Windows with NASM and I have run into some confusion. I am confused as to why I must do this:

extern _ExitProcess@4

Specifically I am confused about the ‘_’ and the ‘@4’. I know that the ‘@4’ is the size of the stack but why is it needed? When I looked in the kernel32.dll with a hex editor I only saw ‘ExitProcess’ not ‘_ExitProcess@4’.

I am also confused as to why C Functions do not need the underscore and the stack size such as this:

extern printf

Why don’t C Functions need decorations?

My third question is “Is this the way I should be using these functions?” Right now I am linking with the actual dll files themselves.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:47:28+00:00Added an answer on June 1, 2026 at 2:47 am

    I know that the ‘@4’ is the size of the stack but why is it needed?

    To enable the linker to report a fatal error if your compiler assumed the wrong calling convention for the function (this can happen if you forget to include header files in C and ignore all the compiler warnings or if a declaration doesn’t exactly match the function in the shared library).

    Why don’t C Functions need decorations?

    Functions that use the cdecl calling convention are decorated with a single leading (so it would actually be _printf).

    The reason why no parameter size is encoded into the decorated name is that the caller is responsible for both setting up and tearing down the stack, so an argument count mismatch will not be fatal for the stack setup (though the calling function might still crash if it isn’t given the right arguments, of course). It might even be possible that the argument count is variable, like in the case of printf.

    When I looked in the kernel32.dll with a hex editor I only saw ExitProcess not _ExitProcess@4.

    The mangled names are usually mapped to the actual exported names of the DLL using definition files (*.def), which then get compiled to *.lib import library files that can be used in your linker invocation. An example of such a definition file for kernel32.dll is this one. The following line defines the mapping for ExitProcess:

    _ExitProcess@4 = ExitProcess
    

    Is this the way I should be using these functions?

    I don’t know NASM very well, but the code I’ve seen so far usually specifies the decorated name, like in your example.

    You can find more information on this excellent page about Win32 calling conventions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been doing some Windows Assembly Language programming lately and I realized that
We have been doing some research into physically isolating the secure and non-secure sections
So I have been doing some research into getting my UTF8 to print correctly.
I have been doing some functional programming and had a question. Perhaps I might
I have been doing some research and this seems to be not possible unless
I have been doing some customization to this jQuery paging script I found here
I have been doing some JavaScript development and I encountered this problem. Consider the
Lately I have been doing some numerical method programming in C. For the bug
I have been doing some research about this and have found a few similar
I'm developing a twitter application for Windows Phone 7 and have been doing some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.