So I have defined 2 classes in 2 separate Apps. One of them is class writer/reader that writes/reads to/from a file and the other is a uplink which requires reading from said file and uploading via a data connection. these classes are defined in 2 separate Apps i.e. they have their own .adef files. Now How do I share the functions that are defined in the reader/writer class to be used by the uplink class? I know that I need to define an api file but where is this file going to reside? My structure is as such:
Should the .api file reside in the Project_dir? Also How to share a function that is defined within a class? Should i be sharing the whole class or write a function that is a wrapper around declaring an object of that class and then the required functions?
one more thing: When I define my api file like such:
FUNCTION string read();
it gives me an error: reader.api:1:1: error: unknown type 'string'
The returnType is optional, and if specified, can be any type that’s not an array, string, or handler.
However, you can specify it as a function parameter with an OUT direction in the .api file, like so:
FUNCTION read(string dest [READ_SIZE] OUT);
Note that there’s a hard limit of 1100 bytes in an API message payload. This limitation is bidirectional, so both client and server messages are affected. See IPC Limitation - #2 by kmurphy.
Since you’re already working with files, perhaps you’d be better suited using File Descriptors instead? This also gets around the 1100 byte message size limit. I’ve used it extensively in the past.
FUNCTION write(file fd_in IN);
FUNCTION read(file fd_out OUT);
Regarding your query on “How to share a function that is defined within a class”
Sharing a function defined/declared within a C++ class is not supported as of now.
i.e, With syntax available to write API files(.api), We can only create the IPC interface for C methods and IPC interface for C++ class methods cannot be created as of now.