C++ library does not export static functions like lib_init()

Bug #1098256 reported by Stephen Woods
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mosquitto
Fix Released
Undecided
Unassigned

Bug Description

Version 1.1 (+ earlier) (Windows)

mosquittopp.h missing mosqpp_EXPORT on following static functions

const char *strerror(int mosq_errno);
const char *connack_string(int connack_code);
int sub_topic_tokenise(const char *subtopic, char ***topics, int *count);
int sub_topic_tokens_free(char ***topics, int count);
int lib_version(int *major, int *minor, int *revision);
int lib_init();
int lib_cleanup();
int topic_matches_sub(const char *sub, const char *topic, bool *result);

should be

mosqpp_EXPORT const char *strerror(int mosq_errno);
mosqpp_EXPORT const char *connack_string(int connack_code);
mosqpp_EXPORT int sub_topic_tokenise(const char *subtopic, char ***topics, int *count);
mosqpp_EXPORT int sub_topic_tokens_free(char ***topics, int count);
mosqpp_EXPORT int lib_version(int *major, int *minor, int *revision);
mosqpp_EXPORT int lib_init();
mosqpp_EXPORT int lib_cleanup();
mosqpp_EXPORT int topic_matches_sub(const char *sub, const char *topic, bool *result);

Can confirm with dumpbin /exports mosquittopp.dll

Work around is to call the mosquitto version e.g.

 #ifdef _WIN32 // lib_init() not in windows lib?
  mosquitto_lib_init();
 #else
  lib_init();
 #endif

Though need to link against both mosquittopp and mosquitto

Revision history for this message
Roger Light (roger.light) wrote :

I agree, this is incorrect. I've made a commit that fixes it for 1.1.1:

https://bitbucket.org/oojah/mosquitto/commits/11ee1ebbb4992d7a09dbabde45675761

Thanks for the report!

Changed in mosquitto:
milestone: none → 1.1.1
status: New → Fix Committed
Changed in mosquitto:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.