API to query the build version of the library

28 views
Skip to first unread message

Rolf Kalbermatter

unread,
Mar 27, 2024, 7:33:27 AMMar 27
to open62541
I am looking at using the open62541 library as a shared library in an application rather than compiling it in my application (with or without amalgation).

It would be helpful if there would be a way to determine the actual build version of such a library. Currently it is possible to query the version of an open62541 OPC server which will report back the build version number of the library, but it would seem a little bit cumbersome to just start up a server instance to be able to query that version.

Is there an API that I overlooked to directly query that version? If not, would it be considered useful by the project maintainers to have such an API (possibly only implemented when compiling for a shared library target, but why)?

Rolf Kalbermatter

Julius Pfrommer

unread,
Mar 27, 2024, 3:16:15 PMMar 27
to open62541

Rolf Kalbermatter

unread,
Mar 27, 2024, 4:38:38 PMMar 27
to open62541
Thanks, I noticed that.

However when you compile a shared library it would be helpful to be able to query the version that was used to compile the shared library. If I include the config.h file in my own application  it says nothing about what version the actual shared library was compiled from. I understand that it is not the mainstream recommended application, so far the suggestion was usually to directly include the amalgation version into a project. But that requires a sure rebuild of the entire app anytime a new version of open62541 comes out.

The API may not yet be really stable enough that binary upwards compatibility can be expected, so recompilation may be required anyhow every time the open62541 library changes, but it would also make sense to be able to update the shared library with minor bugfix versions, without requiring to recompile the whole application.

Regards, Rolf
Op woensdag 27 maart 2024 om 20:16:15 UTC+1 schreef julius....@gmail.com:

Rolf Kalbermatter

unread,
Mar 28, 2024, 11:29:46 AMMar 28
to open62541
Digging through the library there is a slightly roundabout way to do what I want to do.

UA_StatusCode UA_BuildInfo_get(UA_BuildInfo* buildInfo)
{
      UA_ServerConfig config;
      UA_ServerConfig_init(&config);
      UA_BuildInfo_clear(buildInfo);
      UA_StatusCode retval =
           UA_ServerConfig_setBasics(&config);
      if (retval == UA_STATUSCODE_GOOD)
      {
            retval = UA_BuildInfo_copy(&config.buildInfo, buildInfo);
            UA_ ServerConfig _clear(&config);
      }
      return retval;
}

More logical would be to have an exported utility function UA_BuildInfo_get() in the library that is then used in the plugins/ua_config_default.c:setDefaultConfig() function. However that is a somewhat more involved change as it would also require to move some defines such as MANUFACTURER_NAME, PRODUCT_NAME and more from that file into some more common header. As they relate to the whole library and not just a server instance, it would however make sense to do that.

Regards, Rolf

Op woensdag 27 maart 2024 om 21:38:38 UTC+1 schreef Rolf Kalbermatter:
Reply all
Reply to author
Forward
0 new messages