|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Unable to load MQ shared object libraray written in c++ |
« View previous topic :: View next topic » |
Author |
Message
|
Boomn4x4 |
Posted: Tue Dec 20, 2011 6:48 am Post subject: Unable to load MQ shared object libraray written in c++ |
|
|
Disciple
Joined: 28 Nov 2011 Posts: 172
|
I have written a shared object library to make MQ calls from an OpenEdge application.
The .so is compiled using g++, but the functions are extern "C" because OpenEdge cannot understand the function names without it.
The .so works fine, up to the point that I make a MQCONNX call. When I do so, the calling application complains that it cannot load the DLL.
Here is a quick clip of my code.
Code: |
MiStatus msgi_send_one(const char *destType, const char *destination, const char *message, uint32_t messageLength, uint32_t persistance)
{
MiStatus rv = MIS_OK;
LogMessage("INFO", "HERE WE GO");
// char QMgrName[MQ_Q_MGR_NAME_LENGTH];
// MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
// MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
// MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */
/** note, sample uses defaults where it can **/
// MQHCONN Hcon; /* connection handle */
// MQLONG CompCode; /* completion code */
// MQLONG Reason; /* reason code */
// MQLONG CReason; /* reason code for MQCONN */
// MQCNO ConnectOpts = {MQCNO_DEFAULT};
MQCD channelDef = {MQCD_CLIENT_CONN_DEFAULT /*MQCD_DEFAULT*/};
//init_MQCD(&channelDef);
// ConnectOpts.ClientConnPtr = &channelDef;
// ConnectOpts.ClientConnOffset = 0;
// QMgrName[0] = '\0';
// MQCONNX( QMgrName, &ConnectOpts, &Hcon, &CompCode, &CReason);
return rv;
} |
Everything works, messages are written to the declared log file, until the MQCONNX is called. if I comment out that last line, the application fails.
What I find interesting, is that virtually the same application works fine when complied using gcc. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Dec 20, 2011 7:07 am Post subject: Re: Unable to load MQ shared object libraray written in c++ |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Boomn4x4 wrote: |
The .so works fine, up to the point that I make a MQCONNX call. When I do so, the calling application complains that it cannot load the DLL. |
This is an o/s-related error, not an MQ error.
Is the library that contains the DLL in the search path? If you cd to the that library, and then execute the app, does it then work? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Boomn4x4 |
Posted: Tue Dec 20, 2011 7:31 am Post subject: Re: Unable to load MQ shared object libraray written in c++ |
|
|
Disciple
Joined: 28 Nov 2011 Posts: 172
|
bruce2359 wrote: |
Boomn4x4 wrote: |
The .so works fine, up to the point that I make a MQCONNX call. When I do so, the calling application complains that it cannot load the DLL. |
This is an o/s-related error, not an MQ error.
Is the library that contains the DLL in the search path? If you cd to the that library, and then execute the app, does it then work? |
I've copied the DLL to the lib directory that the application uses for all of its library calls. Asside from that, the library is called explicitly from the application with the full path to the .so file. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Dec 20, 2011 7:34 am Post subject: Re: Unable to load MQ shared object libraray written in c++ |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Boomn4x4 wrote: |
bruce2359 wrote: |
Boomn4x4 wrote: |
The .so works fine, up to the point that I make a MQCONNX call. When I do so, the calling application complains that it cannot load the DLL. |
This is an o/s-related error, not an MQ error.
Is the library that contains the DLL in the search path? If you cd to the that library, and then execute the app, does it then work? |
I've copied the DLL to the lib directory that the application uses for all of its library calls. Asside from that, the library is called explicitly from the application with the full path to the .so file. |
Do not copy any libraries out of the MQ install path. You have appeared to be competent enough to know this, and I'm assuming that you mean that you have copied your SO, and not an MQ library file. But for future readers, i repeat... DO NOT COPY ANY LIBRARIES OUT OF THE MQ INSTALL PATH.
Since the issue appears when your SO calls the MQ code, then it's most likely that the MQ libraries are not properly on the application's LIBPATH or LD_LIBRARY_PATH or PATH or etc. etc. etc. |
|
Back to top |
|
 |
Boomn4x4 |
Posted: Tue Dec 20, 2011 7:50 am Post subject: Re: Unable to load MQ shared object libraray written in c++ |
|
|
Disciple
Joined: 28 Nov 2011 Posts: 172
|
mqjeff wrote: |
Boomn4x4 wrote: |
bruce2359 wrote: |
Boomn4x4 wrote: |
The .so works fine, up to the point that I make a MQCONNX call. When I do so, the calling application complains that it cannot load the DLL. |
This is an o/s-related error, not an MQ error.
Is the library that contains the DLL in the search path? If you cd to the that library, and then execute the app, does it then work? |
I've copied the DLL to the lib directory that the application uses for all of its library calls. Asside from that, the library is called explicitly from the application with the full path to the .so file. |
Do not copy any libraries out of the MQ install path. You have appeared to be competent enough to know this, and I'm assuming that you mean that you have copied your SO, and not an MQ library file. But for future readers, i repeat... DO NOT COPY ANY LIBRARIES OUT OF THE MQ INSTALL PATH.
Since the issue appears when your SO calls the MQ code, then it's most likely that the MQ libraries are not properly on the application's LIBPATH or LD_LIBRARY_PATH or PATH or etc. etc. etc. |
You were correct in your assumption that I copied the SO, not the MQ libraries.
The pathing of my MQ libraies was exactly what I needed to hear. I included them when I wrote the C .so, but forgot to do so in my makefile for my c++ .so.
Adding -L /opt/mqm/lib -lmqm to my make file fixed my problem. TOTAL whiff on my part.
Thanks again for all of your help!!!! |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Dec 20, 2011 12:13 pm Post subject: Re: Unable to load MQ shared object libraray written in c++ |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Boomn4x4 wrote: |
TOTAL whiff on my part. |
Deposit USD$1 into the slot at the left. A receipt will print shortly. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
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
|
|
|
|