Show quoted text 14 lines
Thank you to Michalis Kamburelis...
clipped this down (and still too long)...
Yes the integer sizes were confirmed = 32 (win32 gui) and the export was added simply attempting to force a change in memory allocation, along with pre-initializing variables. Among other things, Delphi mode was tried and we boiled the problem down to two lines of code in particular, commented below. As well, we hand converted the Pascal app to C, in order to test the C_wrapper, compiled on GCC and the same calling conventions and methods work fine in C-GCC, but fail in Pascal. VERY ODD. Wrapper works fine.
Review:
//------------------------------
PROBLEM IS BELOW and either comment line removed, will crash = RT217... I suspect the problem is pointer "quote", somehow is crashing registers.
FUNCITON HEADER:
function SetL1Callback(func_addr : pointer) : integer; stdcall; external
'DasRapper.dll' name 'SetL1Callback';>>>> where SetL1Callback(@L1_Callback); is set in the pascal main
area.<<<<<
FUNCTION CALL TO WRAPPER
function L1_Callback(quote : pointer) : integer; stdcall;
var
bid_price : double = 0.0;
s : ansistring = '';
begin
SendMessage(listbox, LB_ADDSTRING, 0, longint(pchar('L1 Callback')));
SendMessage(listbox, LB_ADDSTRING, 0, longint(Get_secsym(quote)));
bid_price := Get_l1_BidPrice(quote);
//s := FloatToStr(bid_price); // This will crash!
//SendMessage(listbox, LB_ADDSTRING, 0, longint(pchar(@s)));
end;
//------------------------------------
PASCAL WRAPPER function being called is below
DllExport void SetL1Callback(TL1Callback p) { DasApi.m_pL1Callback=p; };SUMMARY:
There seems to be nothing I can find that would cause a Runtime 217 in the layout and now finding C conversion of same is working.
Can anyone else please confirm if this should work, or is a bug report be in order??
Thanks to all, whoever may have additional ideas. Mike
