importC function pointers under windows: DMD v2.112.0

DLearner bmqazwsx123 at gmail.com
Mon Apr 20 17:13:26 UTC 2026


On Monday, 20 April 2026 at 16:04:32 UTC, DLearner wrote:
> Consider:
[...]
> To me, there is no 'void' as the void* ptr has been expressly 
> cast to a proper pointer type.

The same situation seems to occur with:

```
#include <stdio.h>
void ccallee3(void)
{
    printf("ccallee3: Entered (written in C).");
    printf("\n");

    printf("ccallee3: Exiting...");
    printf("\n");

    return;
}
```

called by

```
// Calling C subfn via FP
// dmd -betterC cmst3.c ccallee3.c

#include <stdio.h>

extern void ccallee3(void);

void main(void)
{
    typedef void (*ccallee3typPtr)(void);
    ccallee3typPtr wkPtr;


    printf("main: Entered (written in C).");
    printf("\n");

    printf("main: About to call ccallee3 via FP...");
    printf("\n");

    wkPtr = &ccallee3;

    (*(wkPtr))();
//   *(wkPtr)();

    printf("main: Returned from ccallee3.");
    printf("\n");

    printf("main: Exiting...\n");
    return;
}


```

Which is slightly simpler.


More information about the Digitalmars-d-learn mailing list