In C: typedef int (*sieve2_callback_func) ( sieve2_context_t * sieve2_context, void * user_data ); typedef struct { sieve2_values_t value; sieve2_callback_func func; } sieve2_callback_t; sieve2_callback_t my_callbacks[] = { { SIEVE2_DEBUG_TRACE, my_debug }, { SIEVE2_ERRCALL_PARSE, my_errparse }, { SIEVE2_ERRCALL_RUNTIME, my_errexec }, { SIEVE2_ERRCALL_PARSE, my_errparse }, { SIEVE2_ACTION_FILEINTO, my_fileinto }, { SIEVE2_ACTION_REDIRECT, my_redirect }, { SIEVE2_ACTION_REJECT, my_reject }, { SIEVE2_ACTION_NOTIFY, my_notify }, { SIEVE2_ACTION_VACATION, my_vacation }, /* KEEP is essentially the default case of FILEINTO "INBOX". */ { SIEVE2_ACTION_KEEP, my_fileinto }, { SIEVE2_SCRIPT_GETSCRIPT, my_getscript }, /* We don't support one header at a time in this example. */ { SIEVE2_MESSAGE_GETHEADER, NULL }, //{ SIEVE2_MESSAGE_GETHEADER, my_getheader }, /* libSieve can parse headers itself, so we'll use that. */ { SIEVE2_MESSAGE_GETALLHEADERS, my_getheaders }, { SIEVE2_MESSAGE_GETSUBADDRESS, my_getsubaddress }, { SIEVE2_MESSAGE_GETENVELOPE, my_getenvelope }, { SIEVE2_MESSAGE_GETBODY, my_getbody }, { SIEVE2_MESSAGE_GETSIZE, my_getsize }, { 0 } }; What doesn't work in fpc: sieve2_callback_func = function(var sieve2_context; user_data : pointer) : integer; cdecl; sieve2_callback_t = record value : sieve2_values_t; func : sieve2_callback_func; end; callbackAr : Array[1..5] of sieve2_callback_t = ( (value:SIEVE2_ACTION_REDIRECT; func:@myRedirect), (value:SIEVE2_ACTION_KEEP; func:@myKeep), (value:SIEVE2_ACTION_DISCARD; func:@myDiscard), (value:SIEVE2_MESSAGE_GETSIZE; func:@myGetSize), NIL);