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 6253563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:01:20+00:00 2026-05-24T14:01:20+00:00

I have a basic question on function pointer. In the below code snippet, how

  • 0

I have a basic question on function pointer.
In the below code snippet, how do I read this ”
*(FARPROC*)&pfn =“?

IFastString *CallCreateFastString(const char *psz) {

static IFastString * (*pfn)(const char *) = 0;

if (!pfn) {

const TCHAR szDll[] = _TEXT("FastString.DLL");

const char szFn[] = "CreateFastString";

HINSTANCE h = LoadLibrary(szDll);

if (h)

*(FARPROC*)&pfn = GetProcAddress(h, szFn);

}

return pfn ? pfn(psz) : 0;

}
  • 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-24T14:01:21+00:00Added an answer on May 24, 2026 at 2:01 pm

    This isn’t really about function pointers, but about casting in general.

    Suppose pfn is of type T. Then &pfn is of type T*. This gets cast to FARPROC* by the cast expression (the stuff in the parentheses). Finally, this gets dereferenced, yielding a FARPROC&.

    All in all this just means you’re treating pfn as if it were of type FARPROC and assign a value to it.

    Here’s a generic example:

    S make_an_S();
    
    T x;
    T * const px = &x;
    S * const py = (S*)px;
    *py = make_an_S();  // same as *(S*)&x = make_an_S();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a really basic question but... I have some code like this var
Basic question; I have this code: var partipiansRow = '<div class=form-row ><input type=text id=name
I have a basic question on array and pointer in C/C++. Say I have:
In my project I have implemented basic class CVector. This class contains float* pointer
This is a basic question but google didn't provide any help. I have a
Sorry for the basic question - I'm a .NET developer and don't have much
Another basic Rails question: I have a database table that needs to contain references
I have a very basic question and need help. I am trying to understand
Sorry for this basic question but my searches on this are not turning up
I have a basic question about manually removing event listeners in actionscript 3. If

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.