Hi List,
I'm probably over my head on this one and some of the FPC forum entries talk about limited functionality toward C++, but here goes.
A Windows pascal application is recieving data from a C++, VisC API, which is set up as a class, and a conventional C wrapper, attempting to extend functionality into Pascal. C++ and C are vis 4.2 MFC
The application crashes on the callback shown below. The odd thing is that it crashes, simply using a string allocation in pascal. Tried ansistring and others. Assumption, is that the callback is possibly not configuring memory or address pointer correctly and then the String allocation is landing off location by register and stomping on a relative memory location.
Is this a valid implementaiton or outside the scope of FPC?
Thanks in advance for any suggestions.
THE PASCAL is called back to, in the following:
function L1_Callback(quote : pointer) : integer; stdcall; export;
var
bid_price : double;
s : string;
begin
SendMessage(listbox, LB_ADDSTRING, 0, longint('L1 Callback'));
SendMessage(listbox, LB_ADDSTRING, 0, longint(Get_secsym(quote)));
bid_price := Get_l1_BidPrice(quote);
//s := 'test message'; // This will crash!
//s := FloatToStr(bid_price); // Intended call crashes!
//SendMessage(listbox, LB_ADDSTRING, 0, longint(s));
end;THE C WRAPPER has the following:
int CDasApiEx::OnQuote(st_L1Quotes *pQuote)
{
if(m_pL1Callback) (*m_pL1Callback)(reinterpret_cast<void*>(pQuote)); if(m_hWndCallback)
::SendMessage(m_hWndCallback,10000,0,reinterpret_cast<LPARAM>(pQuote)); return 0;
}
Mike
