Consider:

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

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

   return;
}

```

called by:

```
// Calling C subfn via FP
// dmd -betterC cmst2.c ccallee2.c


#include <stdio.h>

extern void ccallee2(void);

void main(void)
{

   void* wkPtr;

   typedef void (*ccallee2typPtr)(void);


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

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

   wkPtr = &ccallee2;

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


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

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


```

As written, compiles and runs correctly.
But either of the two commented-out alternatives produce:
```
Error: can only `*` a pointer, not a `void`

```

To me, there is no 'void' as the void* ptr has been expressly cast to a proper pointer type.

Reply via email to