LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV 6.0.2: an App-built dll gives a runtime error when called by C

I want to use Labview 6.0.2 VIs as DLL's in a Borland C++ Project.
Starting with the simple I have made a VI that returns a constant int32 then built a dll with the Application Builder and put the dll and include file in a BC++ project directory. Compile and link seems to run well. But when excuting the call to the LV fuction gives Fatal Error: labview.lib was not called from a Labview process.
It seems this question was posted before, but answer didn't help me, Sorry.
7.1 -- 2013
CLA
0 Kudos
Message 1 of 5
(2,589 Views)
Hi Gabriela -

This question is answered in the KB article entitled : "LabVIEW.LIB Error When Calling a DLL Built with LabVIEW"

The link for this document is -> http://ae.natinst.com/operations/ae/public.nsf/fca7838c4500dc10862567a100753500/a4c3aef93240280a86256931006fb66c?OpenDocument

Or you can go directly to www.ni.com/support and search for this document and others to help.

The reason for this is that the old labview.lib does not know how to correctly locate the LabVIEW Run-Time Engine when called.
From the document I posted ->
Your dll is most likely making a call If you want to call a Windows DLL or CIN built with a version of cintools before LabVIEW 6.0, you must relink the DLL with the labview.lib from 6.0. If you call an old DLL or CIN in your LabVIE
W DLL, you receive the aforementioned error and the application terminates, because the old labview.lib does not know how to correctly locate the LabVIEW Run-Time Engine when called in this situation.

Good luck-
ben schulte
national instruments
0 Kudos
Message 2 of 5
(2,589 Views)
Thanks so far.
But the given answer is not working for me. I am using a very simple VI that in itself does not call any specific WIN or CIN dll's, at least not to my knowledge. Instead, I am calling this VI, translated into the form of an app-builder-built dll. I have moved all possible LV-system-dlls and libs to the C-program directory and it still does not help. So I am sorry Ben, but "this question is _not_ answered in the KB article" and btw the given link is not accesible from here.
Gabi
7.1 -- 2013
CLA
0 Kudos
Message 3 of 5
(2,589 Views)
The answer to my problem did not lie in the DLL calling Win subfunctions of it's own.
Instead you'll have to take account that all parameters, that are not plain vanilla have to be handled (allocated, freed) by specials calls to labview runtime functions. This is already true for a structure(Labview Cluster), who's space cannot be just allocated in your C-main program. You have to allocate that space by calling DSNewHandle. Here you'll get back a type that'll make that funny pointer to a pointer to a pointer thing that App-builder defines as parameter more sensble.

Gabriela
7.1 -- 2013
CLA
Message 4 of 5
(2,589 Views)
I posted the same question but with MS VC++. The answers I got from Dev zone and NI germany support didn't solve this problem. I didn't work on this problem until now. If you have got an answer please contoct me at waldemar@hersacher.de.
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 5 of 5
(2,589 Views)