Jump to content

Calling external DLL fails


Recommended Posts

Posted

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

Posted

maybe the wrong calling convention in the function prototype ?

maybe i can help, if you post the code and the function prototype ?

cheers,

cb

Posted
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

Posted
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.