|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Error when calling Get |
« View previous topic :: View next topic » |
Author |
Message
|
lifeng |
Posted: Wed Feb 06, 2008 1:47 pm Post subject: Error when calling Get |
|
|
Apprentice
Joined: 11 Jan 2008 Posts: 46
|
Hi,
I am calling MQGET API using the following C++.Net code.
unsigned short readmessage(short indx )
{
unsigned short retcode=0;
gmo.Version = MQGMO_VERSION_2; gmo.MatchOptions = MQMO_NONE;
gmo.Options = MQGMO_WAIT
| MQGMO_CONVERT
| MQGMO_MSG_UNDER_CURSOR // <=== (1)
| MQGMO_ACCEPT_TRUNCATED_MSG;
gmo.WaitInterval = 1000;
md.Encoding = MQENC_NATIVE;
md.CodedCharSetId = MQCCSI_Q_MGR;
short x = MQCC_UNKNOWN;
short * rtn = &x;
char * buf = MQUtility::MQGET(indx, md, gmo, rtn);
retcode = (unsigned short)(*rtn);
return(retcode);
} // <=== (2)
Here, the function MQUtility::MQGET will call the MQQueue's Get method with options, etc. When I run this, the call returns with an exception of the following message:
"MQRC_NO_MSG_UNDER_CURSOR"
If, however, I comment out the line "| MQGMO_MSG_UNDER_CURSOR" (see line lable "<=== (1)") then I can read the message out (and I can see the value when I debug it). But, after that, right before the method finishes, I will get the following error at line ("<=== (2)"):
"The runtime has encountered a fatal error. The address of the error was at 0x7a2ba518, on thread 0x808. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack."
What am I doing wrong here? What should I do to fix it?
Thanks.
Lifeng |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 06, 2008 1:54 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It makes sense that MQGMO_MSG_UNDER_CURSOR would cause your code to fail - you're not Browsing, so as the error says there is no message under the cursor.
The rest of your error is likely explained by all the odd things you are doing to assign retcode.
And remember that MQCC_OK is 0...
It's also not clear why you're trying to use a Procedural interface from an Object-Oriented language (c++) running in an Object-Oriented container (.NET).
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzav.doc/csqzav05.htm _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|