Skip to content

Commit

Permalink
[FIXED] Added missing NATS_EXTERN on some functions. (#836)
Browse files Browse the repository at this point in the history
Namely `nats_OpenWithConfig` and `natsConnection_Reconnect`.

Also normalized the `NATS_EXTER <return type>` in one line and
the function name on the next line.

Updated the C++ compile test since it was failing on my mac env,
and modified `nats_StringEquals` that was triggering a warning
on my Windows VM build.

Resolves #835

Signed-off-by: Ivan Kozlovic <[email protected]>
  • Loading branch information
kozlovic authored Feb 16, 2025
1 parent 6d6590b commit b04bf34
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/nats.h
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,7 @@ typedef void (*stanConnectionLostHandler)(
* @param config points to a natsClientConfig. A copy of the settings is made,
* so the config can be freed after initializing the NATS client.
*/
natsStatus
NATS_EXTERN natsStatus
nats_OpenWithConfig(natsClientConfig *config);

/** \brief Initializes the library.
Expand Down Expand Up @@ -1964,7 +1964,8 @@ nats_GetVersionNumber(void);
* @see nats_GetVersion
* @see nats_GetVersionNumber
*/
NATS_EXTERN bool nats_CheckCompatibility(void);
NATS_EXTERN bool
nats_CheckCompatibility(void);
#else

#define nats_CheckCompatibility() nats_CheckCompatibilityImpl(NATS_VERSION_REQUIRED_NUMBER, \
Expand Down Expand Up @@ -4216,7 +4217,7 @@ natsConnection_Connect(natsConnection **nc, natsOptions *options);
*
* @param nc the pointer to the #natsConnection object.
*/
natsStatus
NATS_EXTERN natsStatus
natsConnection_Reconnect(natsConnection *nc);

/** \brief Process a read event when using external event loop.
Expand Down Expand Up @@ -8377,7 +8378,8 @@ microService_Run(microService *m);
*
* @see #micro_AddService, #microService_Run
*/
NATS_EXTERN microError *microService_Stop(microService *m);
NATS_EXTERN microError *
microService_Stop(microService *m);

/** @} */ // end of microServiceFunctions

Expand Down
2 changes: 1 addition & 1 deletion src/natsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static inline bool nats_StringEquals(const char *s1, const char *s2)
if (s2 == NULL)
return false;

return strcmp(s1, s2);
return strcmp(s1, s2) == 0;
}

#define DUP_STRING(s, s1, s2) \
Expand Down
3 changes: 1 addition & 2 deletions test/check_cpp/check_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <iostream>
#include <nats.h>

// Check C++ compiler compatibility of structs in
Expand All @@ -24,6 +23,6 @@ int main(int argc, char **argv)
jsFetch fetch;
fetch.opts.Timeout = 1;

std::cout << "OK" << std::endl;
printf("OK\n");
return 0;
}

0 comments on commit b04bf34

Please sign in to comment.