Closed fswarbrick closed 4 years ago
I think that you probably cannot do it right now because of how the compiler ends up embedding two copies of the cmqstrc code. I couldn't find any way to do it outside of changing the ibmmq
package.
HOWEVER ....
The next iteration of the code, that I'm working on now, will include direct access to all of the cmqstrc.h string mapping functions, not just the subset that's currently in mqistr.go. So then you should be able to use ibmmq.MQItoString("MQFB",int(mqmd.Feedback))
I ended up kludging things a bit. I copied the function, with a different name, directly in to the program in the cgo format. And that worked.
One thing I thought I saw "on the internet" was to just include a function prototype:
extern char *MQFB_STR (MQLONG v);
This compiled fine, but the link failed with "undefined reference". I really thought that would work, too. Ah well.
Good to know this package is still a going concern and I look forward to the next iteration. I find this library/wrapper to me very well done and very enjoyable to use! I'm just a "go" dabbler and won't be using it for anything "real", but I still appreciate it.
v5.0.0 was released this week and should deal with this
Great! I shall take a look.
This is probably more of a question than an actual issue, but I couldn't find anywhere else to ask.
Using MQ V9.1, current mq-golang, go1.14.2 windows/amd64
/*
#cgo windows CFLAGS: -I"C:/Program Files/IBM/MQ/Tools/c/include"
#include <cmqc.h>
#include <cmqstrc.h>
*/
import "C"
fmt.Println(mqmd.Feedback, C.GoString(C.MQFB_STR(C.MQLONG(mqmd.Feedback))))
The issue is that during the linking step its saying there are multiple definitions of each of the functions that are defined in cmqstrc.h. Of course if I don't include this header file then the compiler complains it cannot find MQFB_STR. Any thoughts on how I can invoke MQFB_STR from my application?