LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW crashes when calling a dll

I am trying to call a dll through my LabVIEW program. The dll implements a routine to access an ftp server. When the server is found, everything works as expected. However, if there is a delay in finding the server, LabVIEW throws an error � �An exception occured within the external code called by the Call Library Node�. The detailed error message is attached here.

The dll function times out after 25 seconds if the server is not found (it returns a signed integer). This error message pops up after roughly 20 seconds.

The dll was created in VC++ 6.0. It uses standard MFC calls.

Any information about why this could be happening will be appreciated.

Thanks.
0 Kudos
Message 1 of 2
(2,680 Views)
Hi,

If you call a dll, everything should be just right, or it will crash (if you
use LV7, you're lucky, most of the times LV stays alive, and only gives a
message).

The first thing that should be checked is the calling convention. This
should probably be "stdcall (API)". This changes the way the parameters and
return address are pushed to the stack.

The second point are the parameters. Pointers should be set to pointers,
LONG to i32 etc. The return parameter can always be set to i32, or to
nothing.

My best guess is (since the dll crashes after a while), there should be a
pointer to a buffer (most likely a cluster, but could be a reference). The
connection succeeds, and the dll copies the information to the pointer. If
the pointer is not valid (the memory does
not belong to LabVIEW), an
exception is raised.

Perhaps you can give a function prototype? The prototype is the way to
start.

Regards,

Wiebe.



"gopinath" wrote in message
news:506500000008000000DAA80000-1066448259000@exchange.ni.com...
I am trying to call a dll through my LabVIEW program. The dll
implements a routine to access an ftp server. When the server is
found, everything works as expected. However, if there is a delay in
finding the server, LabVIEW throws an error - "An exception occured
within the external code called by the Call Library Node". The
detailed error message is attached here.

The dll function times out after 25 seconds if the server is not found
(it returns a signed integer). This error message pops up after
roughly 20 seconds.

The dll was created in VC++ 6.0. It uses standard MFC calls.

Any information about why this could be happening will be appreciated.

Thanks.
0 Kudos
Message 2 of 2
(2,680 Views)