C API Callbacks

Moderator: Moderator

C API Callbacks

Postby jhouchin » Mon Oct 14, 2013 12:04 am

Hello,

I am trying to understand some of the functions in the C API.

In the TableListener and the ResponseListener classes there are functions which require callbacks.

I am not finding any documentation on the callbacks nor the the TableListener_set* and ResponseListener_set* functions in the API.

I am exploring an implementation in Pharo Smalltalk or in Lua.

Some documentation or a Lua implementation of a TableListener and/or ResponseListener classes in Luajit using the C API via FFI would be a tremendous help.

There are a number of things in the C API which do not match the samples or documentation for the C++ API. And there is very little in the way of samples and no documention (that I have found) for the C API wrapper code.

Any help or understanding greatly appreciated.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas

Re: C API Callbacks

Postby jhouchin » Mon Oct 14, 2013 8:13 am

For greater clarity in my question.

Who calls these functions? When are they called? What happens when they are called?
ResponseListener_setRequestCompleted, ResponseListener_setRequestFailed, ResponseListener_setTablesUpdates, TableListener_create, TableListener_setOnAdded, TableListener_setOnChanged, TableListener_setOnDeleted, TableListener_setOnStatus

I have not found any mention of these functions in any of the APIs' samples or docs.

I was working my way through writing code to work through some of the samples, but you have to have a TableListener or ResponseListener class to do most anything. So you don't get very far before you run into a lack of knowledge issue.

I am not a C programmer. So callbacks are not anything I am knowledgeable about. SessionStatusListener was not too hard to work through. But I would love some help on the TableListener and the ResponseListener classes.

All that remains beside these two classes are the SessionStatusListener class, and the Table_forEachRow, Session_useTableManager functions. If these items were documented, we would have filled in much of the information that is not available from the other API documentation and samples.

Thanks.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas

Re: C API Callbacks

Postby Gennadiy » Tue Oct 15, 2013 6:31 am

I am not finding any documentation on the callbacks nor the the
TableListener_set* and ResponseListener_set* functions in the API


Actually these methods are intended to replace semantic constructions
which exist in native C++. So you can just ignore prefix "_set" and
find the information about all the methods in C++ documentation.
Gennadiy
 

Re: C API Callbacks

Postby jhouchin » Tue Oct 15, 2013 9:03 am

Hello, thanks for the reply.

Here is where my lack of understanding comes in.

Code: Select all
void TableListener_setOnAdded(FXCHandle listener, TABLE_ROW_CALLBACK onAdded);

vs.
Code: Select all
void onChanged(const char *, IO2GRow *);


They take completely different arguments.

Am I to simply understand that when I call TableListener_setOnAdded with the same listener instance and the same callback instance everytime that this function will call the callback with the proper arguments as per the onChanged documentation. And when my callback does the right thing, then all works as should. Yes?

Thanks.
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas

Re: C API Callbacks

Postby Gennadiy » Wed Oct 16, 2013 5:40 am

Hello Jimmie,

Yes, you think right. All should work well. But you should compare TableListener_setOnAdded and onAdded (instead of onChanged).
Gennadiy
 

Re: C API Callbacks

Postby jhouchin » Wed Oct 16, 2013 9:00 am

Hello, thanks for the reply.

Yes, I copied the wrong C++ source. I was looking at the documentation for the onAdded. Regardless the arguments are the same for all of the set* functions regardless of the arguments to its corresponding C++ method, the FXCHandle instance, and the callback instance.

I'll give it a go when I get an opportunity.

Thanks.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas


Return to ForexConnect API

Who is online

Users browsing this forum: No registered users and 4 guests