gyc Posted July 6, 2005 Report Share Posted July 6, 2005 I am trying to use an external DLL with LV. This DLL is known to work with VB and C++; however, when I call it LV traps a low level memory corruption error and stops the VI. What might be the problem - or what am I doing wrong? Gyc Quote Link to comment
i2dx Posted July 6, 2005 Report Share Posted July 6, 2005 maybe the wrong calling convention in the function prototype ? maybe i can help, if you post the code and the function prototype ? cheers, cb Quote Link to comment
gyc Posted July 6, 2005 Author Report Share Posted July 6, 2005 maybe the wrong calling convention in the function prototype ?maybe i can help, if you post the code and the function prototype ? cheers, cb 5236[/snapback] Here's the prototype: int ADAMTCP_Connect(char szIP[], unsigned short port, int iConnectionTimeout, int iSendTimeout, int iReceiveTimeout); Download File:post-2388-1120680769.vi Quote Link to comment
i2dx Posted July 6, 2005 Report Share Posted July 6, 2005 the string input is the problem. the help you need can be found here: http://zone.ni.com/devzone/conceptd.nsf/we...6256869005ff2ed good look CB Quote Link to comment
gyc Posted July 6, 2005 Author Report Share Posted July 6, 2005 the string input is the problem.the help you need can be found here: http://zone.ni.com/devzone/conceptd.nsf/we...6256869005ff2ed good look CB 5238[/snapback] I tried to pass the string as "handle" and as "handle pointer" but it doesn't work: LV is just kicked out with absolutely no messages. Thanks anyway! Gyc Quote Link to comment
Rolf Kalbermatter Posted July 11, 2005 Report Share Posted July 11, 2005 I tried to pass the string as "handle" and as "handle pointer" but it doesn't work: LV is just kicked out with absolutely no messages.Thanks anyway! Gyc 5239[/snapback] That's because the DLL does NOT expect a LabVIEW handle or even a pointer to such. Instead it expects a pointer to a C string. char somevar[] is equivalent to char *somevar as far as the C compiler is concerned. This is definitely a C string pointer. Configure the Call Library Node parameter accordingly and you should be fine. A LabVIEW string handle or pointer to such can only ever be used for DLLs which have been explicitedly developed to be called by LabVIEW. Rolf Kalbermatter Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.