Languages

Menu
Sites
Language
Too many arguments error for message port function

I have been trying to use the Message Port api in my project to communicate between a native service app and a native ui app. Following the development guide and the code examples, I included the necessary header files and implemented the functions for sending a bundle over the message port.

The issue i'm facing now is that I get a compilation error of "too many arguments to function call for the following functions: message_port_check_trusted_remote_port()

message_port_send_message()

The error claims that it expects 2 arguments and I am providing 3 arguments. However, the api documentation, the function definition, and the code examples all show three arguments needing to be passed. I was able to get the sample project working on it's own. The issue arises when I try to use the message port functions in my existing project, which has several other libraries being used. This makes me suspect that one of the other libraries i am using is interfering with the message port library.

Has anyone else experienced this or something similar?

Edited by: William Kirkpatrick on 09 Feb, 2018
View Selected Answer

Responses

2 Replies
Mark as answer
K Johnson

According to the tutorial,  message_port_send_message() function should take 3 params. May be the problem is with your code related to other libraries. In that case, my suggestion is, at first make message port communication work following the tutorial or sample app then add codes related to other features. Also please add codes which you really need and understand clearly.

William Kirkpatrick

Was able to resolve the issue!

It did end up being a conflicting library which was carried over from a previous version of the project. However, after the error went away from removing the unneccessary #include, I re-added the #include and the project was still able to build. So, still not sure exactly why it didn't build properly before, but it is working now.

Still solid advice: triple check the libraries you have included in your projects don't interfere with each other across the header files.