ibm mq - Import MQIC.DLL in C# -


in system, need load mqic.dll (ibm websphere mq) send , messages mq server.

currently, service running in vb5, , need upgrade .net. when try load library, error:

attempted read or write protected memory. indication other memory corrupt.

the code:

[dllimport("mqic.dll", entrypoint = "mqconnstd@16", setlasterror = true)] public static extern void mqconn(string qmgrname, long hconn, long compcode, long reason); 

does have idea why it's happening?

the vb5 code:

declare sub mqconn lib "mqic.dll" alias "mqconnstd@16" (byval qmgrname string, hconn long, compcode long, reason long) 

this mqod struct:

public struct mqod {     public string strucid; //structure identifier'     public long version; //structure version number'     public long objecttype; //object type'     public string objectname; //object name'     public string objectqmgrname; //object queue manager name'     public string dynamicqname; //dynamic queue name'     public string alternateuserid; //alternate user identifier' } 

change declaration of mqconn use out long long parameters.

check mq application programming reference each api call, , make sure use out or ref every parameter described output or input/output.

you can cmqc.h in mq installation directory, provided have installed development environment. has declarations of mqi calls. can transcribe c header c# - wherever see pointer (*) use out or ref.

but speaking, going better off using managed .net classes mq, others suggested.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -