Example using sharing .api function returning strings

I’m trying to do the same as HelloIPC sample App but instead of having a function that takes a string as an IN I want it to return a string i.e. have it as such:

	string message[1024] OUT ///< message to be inserted into the log.

The issue is how can i define this function in my c file in order not to have any undefined reference. Whenever I define i like such:

const char * msg "******** Client says Something *******";
void printer_Get( char* message)
    message = msg; 

I have undefined reference error. How can I return a string from this function since the returnType cannot be string??

Hi @mg_bg

You have to also provide the length of the destination buffer you want to write to.

Check out the inc-gen folder within your app build directory. Look for a file with a name such as [my_api_name]_server.h and it should give you hints as to how the functions from your api should be defined in c.

Try this:

void printer_Get(char* message, size_t messageNumElements)