Hi Sekel, I'm calling apr_table_vdo from a TObject decended class constructor. And am populating a TStringList (for now) with the key and value. At the moment I am using a a global TStringList instead of passing it to ProcessHeader using the rec pointer.
The strange thing is this, I now have key and value aligning correctly... To do this I have the callback procedure type defined with stdcall but ProcessHeaders defined with cdecl!!
type
apr_table_do_callback_fn_t = function (rec: Pointer;
const key, value: PChar): Integer; stdcall;
function ProcessHeader(rec: Pointer; const key, value: PChar): Integer; cdecl;
begin
TmpHeaders.add(PChar(key),PChar(value));
result := 1;
end;
Out of intrest the above does not work in objfpc mode, you get as would be expected the following compiler error:
Error: Incompatible type for arg no. 1: Got "<address of function(Pointer,const PChar,const PChar):LongInt;CDecl>", expected "<procedure variable type of function(Pointer,const PChar,const PChar):LongInt;StdCall>"
However we are working in Delphi mode, and so provided this is acurate Delphi behaviour it is not a problem for me.
I'll try and put together a simplyified unit later today...