Hello,

I'm trying to use a c library where I can define a logging plugin.

The c prototype for the callback is

void (*log)(void *logContext, UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args);


however I couldn't find a way to define a suitable callback in fpc since the "array of const" construct is not allowed with cdecl without external, i.e.

procedure LogLog(logContext: Pointer; level: UA_LogLevel; category: UA_LogCategory; msg: PAnsiChar; const args:array of const);cdecl;

gives an error "Error: VarArgs directive (or '...' in MacPas) without CDecl/CPPDecl/MWPascal/StdCall and External".

I cannot add "external" (I don't want to call an external function, it's the library calling my function) or remove the cdecl (parameter passing wouldn't work then).

Is there some trick to define a function with varargs callable from the c library?

Bye
--
Luca
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to