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

  • Home
  • SEARCH
  • 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 6673455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:37:45+00:00 2026-05-26T03:37:45+00:00

Okay, so I can call function as fastcall CC, by declaring it with __attribute__((fastcall))

  • 0

Okay, so I can call function as fastcall CC, by declaring it with __attribute__((fastcall)).
How do I define the function itself as fastcall?

Like, I have caller code:

// caller.c

unsigned long func(unsigned long i) __attribute__((fastcall));

void caller() {
    register unsigned long i = 0;
    while ( i != 0xFFFFFFD0 ) {
        i = func(i);
    }
}

And the function:

// func.c

unsigned long func(unsigned long i) {
    return i++;
}

In this code, func() is being compiled as cdecl, it extracts i from stack, not from ecx(this is i386).

If I write unsigned long func(unsigned long i) __attribute__((fastcall)); in func.c it just won’t compile, saying

error: expected ‘,’ or ‘;’ before ‘{’ token

If I declare it in func.c the same way I did in caller.c, it will complain the other way:

error: previous declaration of ‘func’ was here
  • 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-05-26T03:37:46+00:00Added an answer on May 26, 2026 at 3:37 am

    Attributes must be applied in the declaration, not in the definition.

    Try:

    __attribute__((fastcall)) unsigned long func(unsigned long i) ;
    __attribute__((fastcall)) unsigned long func(unsigned long i) {
        return i++;
    }
    

    The standard way to do this is to put the declaration in a header and have both source files include the header

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

Sidebar

Related Questions

I can't believe I've stared at the following code as long as I have:
Okay, so I have a website where the user can put a search query
Okay i have two models: posts and comments. as you can think comments has
To anyone who can help, Thanks Okay, so I have a database holding a
Okay, so I have an javascript function that retrieves some HTML... function updateQuestions(i){ var
Okay, so right now I'm trying to call an Ajax function from a normal
Okay, I have a JavaScript file with the following functions: function AskReason() { var
Assuming I have a decorator and a wrapped function like this: def squared(method): def
Okay, I have two sites, we'll call them A and B. Site A has
Okay been working on this too long and can't get it to work. I

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.