View Single Post
Old 28 February 2022, 14:49   #3
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
Using typedef is the first thing that I tried. However it seems fd2pragma does not support that as it gave me an error. Reading the documentation I found the following;

"fd2pragma knows all standard parameter types defined in exec/types.h and dos/dos.h, all structures and some more types. All other #typedef's bring a warning. Do not use them in prototypes files!"

This is why I then took the other approach.

Quote:
Originally Posted by phx View Post
This is certainly a bug in fd2pragma, but not trivial to fix.
Usually such function pointer types are avoided in dynamic libraries. Or simply replaced by
APTR
.
I would suggest to define the function pointer return value type with a
typedef
in your clib header:
Code:
typedef int (*MYFUNCTYPE)(int,int);
Then you can declare the function's prototype as
Code:
MYFUNCTYPE getFunction(void);
and fd2pragma might have less problems to generate correct code (it is more readable too).
Sim085 is offline  
 
Page generated in 0.05593 seconds with 11 queries