[PATCH 33/50] [examples] Changes for Windows


Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@nyx.com>

Use correct calling convention for callbacks and a few other minor
changes.

Signed-off-by: Mike Schonberg <mschonberg@nyx.com>
---
mama/c_cpp/src/examples/c/mamaftmemberc.c | 4 ++--
mama/c_cpp/src/examples/c/mamainboxc.c | 4 ++++
mama/c_cpp/src/examples/c/mamalistenc.c | 1 -
mama/c_cpp/src/examples/c/mamamultisubscriberc.c | 14 +++++++++++---
mama/c_cpp/src/examples/c/mamaproxyc.c | 4 ++++
mama/c_cpp/src/examples/c/mamapublisherc.c | 2 +-
6 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/mama/c_cpp/src/examples/c/mamaftmemberc.c b/mama/c_cpp/src/examples/c/mamaftmemberc.c
index 8ba53c2..e2e3aa9 100644
--- a/mama/c_cpp/src/examples/c/mamaftmemberc.c
+++ b/mama/c_cpp/src/examples/c/mamaftmemberc.c
@@ -51,14 +51,14 @@ static void parseCommandLine (int argc, const char **argv);
static void initializeMama (void);
static void createFtMember (void);

-static void onFtStateChangeCb (mamaFtMember ftMember,
+static void MAMACALLTYPE onFtStateChangeCb (mamaFtMember ftMember,
const char* groupName,
mamaFtState state,
void* closure);

static void usage (int exitStatus);

-static void onFtStateChangeCb (mamaFtMember ftMember,
+static void MAMACALLTYPE onFtStateChangeCb (mamaFtMember ftMember,
const char* groupName,
mamaFtState state,
void* closure)
diff --git a/mama/c_cpp/src/examples/c/mamainboxc.c b/mama/c_cpp/src/examples/c/mamainboxc.c
index 4e2b9b7..48d50a7 100644
--- a/mama/c_cpp/src/examples/c/mamainboxc.c
+++ b/mama/c_cpp/src/examples/c/mamainboxc.c
@@ -198,6 +198,10 @@ static void sendRequest (void)
exit (status);
}

+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "mamaPublisher_sendFromInboxWithThrottle(): "
+ " %s",
+ mamaMsg_toString(msg));
/*The message can be destroyed once the sendCompleteCb has been invoked.*/
status = mamaPublisher_sendFromInboxWithThrottle (gPublisher, gInbox, msg,
sendCompleteCb, NULL);
diff --git a/mama/c_cpp/src/examples/c/mamalistenc.c b/mama/c_cpp/src/examples/c/mamalistenc.c
index 80ca789..be270d1 100644
--- a/mama/c_cpp/src/examples/c/mamalistenc.c
+++ b/mama/c_cpp/src/examples/c/mamalistenc.c
@@ -763,7 +763,6 @@ transportCb (mamaTransport tport,
void initializeMama (void)
{
mama_status status = MAMA_STATUS_OK;
- mamaPayloadBridge payBridge = NULL;

/*
mama_setApplicationName should be called before mama_open().
diff --git a/mama/c_cpp/src/examples/c/mamamultisubscriberc.c b/mama/c_cpp/src/examples/c/mamamultisubscriberc.c
index 2364ffb..c017dc9 100644
--- a/mama/c_cpp/src/examples/c/mamamultisubscriberc.c
+++ b/mama/c_cpp/src/examples/c/mamamultisubscriberc.c
@@ -21,7 +21,6 @@

#include "mama/mama.h"
#include "string.h"
-#include <unistd.h>
#define MAX_BRIDGES 10

static const char * gTopic = "MAMA_TOPIC";
@@ -52,21 +51,24 @@ NULL
static void parseCommandLine (int argc, const char **argv);
static void initialize (void);
static void createSubscriber (mamaBridge bridge, mamaTransport transport);
-static void startCB ( mama_status status );
+static void MAMACALLTYPE startCB ( mama_status status );
static void start (void);
static void displayMsg (mamaMsg msg);
static void usage (int exitStatus);

static void
+MAMACALLTYPE
displayCb (const mamaMsg msg,
const mamaMsgField field,
void * closure);

static void
+MAMACALLTYPE
createCb (mamaSubscription subscription,
void * closure);

static void
+MAMACALLTYPE
errorCb (mamaSubscription subscription,
mama_status status,
void* platformError,
@@ -74,6 +76,7 @@ errorCb (mamaSubscription subscription,
void* closure);

static void
+MAMACALLTYPE
msgCb (mamaSubscription subscription,
mamaMsg msg,
void * closure,
@@ -189,7 +192,8 @@ static void createSubscriber (mamaBridge bridge, mamaTransport transport)
}
}

-void startCB ( mama_status status )
+void MAMACALLTYPE
+startCB ( mama_status status )
{}

void start ()
@@ -206,6 +210,7 @@ void start ()
}

static void
+MAMACALLTYPE
createCb (mamaSubscription subscription, void *closure)
{
if (gQuietLevel < 2)
@@ -215,6 +220,7 @@ createCb (mamaSubscription subscription, void *closure)
}

static void
+MAMACALLTYPE
errorCb (mamaSubscription subscription,
mama_status status,
void* platformError,
@@ -227,6 +233,7 @@ errorCb (mamaSubscription subscription,
}

static void
+MAMACALLTYPE
msgCb (mamaSubscription subscription,
mamaMsg msg,
void* closure,
@@ -240,6 +247,7 @@ msgCb (mamaSubscription subscription,
}

void
+MAMACALLTYPE
displayCb (const mamaMsg msg,
const mamaMsgField field,
void* closure)
diff --git a/mama/c_cpp/src/examples/c/mamaproxyc.c b/mama/c_cpp/src/examples/c/mamaproxyc.c
index dfb5aa0..e50fb84 100644
--- a/mama/c_cpp/src/examples/c/mamaproxyc.c
+++ b/mama/c_cpp/src/examples/c/mamaproxyc.c
@@ -182,6 +182,10 @@ static void createPublisher ()
"_MD",
NULL);

+ // Turn off updateing of the messages as incoming messages
+ // from FH already have seqnum and senderid
+ mamaDQPublisherManager_setSeqNum(gDQPubManager, 0);
+ mamaDQPublisherManager_setSenderId(gDQPubManager, 0);
if (gSendSync)
{
mamaTimer_create (&gSyncTimer, gPubDefaultQueue, syncCallback, 15, gDQPubManager);
diff --git a/mama/c_cpp/src/examples/c/mamapublisherc.c b/mama/c_cpp/src/examples/c/mamapublisherc.c
index e00ea9d..a5fce51 100644
--- a/mama/c_cpp/src/examples/c/mamapublisherc.c
+++ b/mama/c_cpp/src/examples/c/mamapublisherc.c
@@ -305,7 +305,7 @@ inboundMsgCb (mamaSubscription subscription,

if (gQuietLevel < 2)
{
- printf ("Recieved inbound msg. Sending response\n");
+ printf ("Recieved inbound msg. (%s) Sending response\n", mamaMsg_toString (msg));
}

if (!mamaMsg_isFromInbox (msg))
--
1.7.7.6

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.