Char* string parameters in nvmsgbroker.h should be declared const

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
Jetson / GPU
• DeepStream Version
6.0
• JetPack Version (valid for Jetson only)
4.6
• TensorRT Version

• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)

All char* string parameters are missing const keyword.
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)

Include and reference in C++ application.

• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

For those of us using C++, the current function definitions in nvmsgbroker.h force us to cast away the const qualification from all std::string input parameters.

For example

NvMsgBrokerClientHandle   nv_msgbroker_connect(char *broker_conn_str, char *broker_proto_lib, nv_msgbroker_connect_cb_t connect_cb, char *cfg);

ends up getting called as

m_connectionHandle = nv_msgbroker_connect(
    const_cast<char*>(m_connectionString.c_str()), 
    const_cast<char*>(m_protocolLib.c_str()),
    broker_connection_listener_cb, 
    const_cast<char*>(m_brokerConfigFile.c_str()));

It works… but it’s an ugly workaround.

I’ve used most of your APIs at this point, and I believe this is the only client file that has this const char* omission.

Thanks for your advice!

Looking at your protocol-adapter tests and plugin documentation… seeing all of the dependencies on the current prototype definitions, I’m sure it’s not worth changing at this point.

But, thanks for getting back.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.