LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView-Dll and c++ (with FieldPoint)

Hi,

i've just startet to work with LabView and am trying to solve a (actually simple) problem:

I want to read the 8 analog input-channels and the 4 relay-channels of a connected FieldPoint (FP-1601, FP-RLY-422, FP-AI-100). This functionality should be used as a dll in a c++-program.

By now i'm able to read the channels in the vi but the usage of the dll in my c++-program behaves a little strange:

Calling the LVDLLStatus-function of the dll in my program allways results in error 1003 (kLVE_VIBad, The VI is not executable -> according to LabView-help) and the error-msg is the name of the vi.

Do i have to take care of something special making a dll with FieldPoint-assistance? For testing i also made some simple dll's without FieldPoint-assistance which worked fine (i.e. to add up figures).

Independent of the "FieldPoint-problem" there is another problem i'm struggling with:

At the first call of a dll-function the program hangs up with the following error-message:

"FieldPointTest.exe has triggered a breakpoint"

At this point i can continue the execution by pressing the "continue"-button whereupon execution of the program proceeds nomally (also when i call another dll-function).
After the hang-up there is a new message in the program-output which says:

"DLL 'C:\Program Files\National Instruments\Shared\LabVIEW Run-Time\7.1\DNCompInfo.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang."

This problem also appears at dll's without FieldPoint but only when i start the execution out of the designer (Visual Studio 2005). If i start the compiled exe the program executes normally without any error-messages.

I hope there is somebody who can help me any further cause i've allready searched a lot in the internet and can't find anything help anymore. Especially regarding FieldPoint in alliance with LabView and dll's i can't find anything helpful!

thanks, best regards

mike
0 Kudos
Message 1 of 3
(3,553 Views)
May be a look on this site helps:
http://zone.ni.com/devzone/devzone.nsf/webcategories/E2A99E7E10D5725D862567A
C004F0A53


Hansjörg

"suamikim" <x@no.email> schrieb im Newsbeitrag
news:1138869637238-319089@exchange.ni.com...
> Hi,
>
> i've just startet to work with LabView and am trying to solve a (actually
simple) problem:
>
> I want to read the 8 analog input-channels and the 4 relay-channels of
> a connected FieldPoint (FP-1601, FP-RLY-422, FP-AI-100). This
> functionality should be used as a dll in a c++-program.
>
> By now i'm able to read the channels in the vi but the usage of the dll in
my c++-program behaves a little strange:
>
> Calling the LVDLLStatus-function of the dll in my program allways results
in error 1003 (kLVE_VIBad, The VI is not executable -&gt; according to
LabView-help) and the error-msg is the name of the vi.
>
> Do i have to take care of something special making a dll with
> FieldPoint-assistance? For testing i also made some simple dll's
> without FieldPoint-assistance which worked fine (i.e. to add up
> figures).
>
> Independent of the "FieldPoint-problem" there is another problem i'm
struggling with:
>
> At the first call of a dll-function the program hangs up with the
following error-message:
>
>
> "FieldPointTest.exe has triggered a breakpoint"
>
>
> At this point i can continue the execution by pressing the
> "continue"-button whereupon execution of the program proceeds nomally
> (also when i call another dll-function).
> After the hang-up there is a new message in the program-output which says:
>
>
> "DLL 'C:\Program Files\National Instruments\Shared\LabVIEW
> Run-Time\7.1\DNCompInfo.dll' is attempting managed execution inside OS
> Loader lock. Do not attempt to run managed code inside a DllMain or
> image initialization function since doing so can cause the application
> to hang."
>
> This problem also appears at dll's without FieldPoint but only when
> i start the execution out of the designer (Visual Studio 2005). If i
> start the compiled exe the program executes normally without any
> error-messages.
>
> I hope there is somebody who can help me any further cause i've
> allready searched a lot in the internet and can't find anything help
anymore.
> Especially regarding FieldPoint in alliance with LabView and dll's i
> can't find anything helpful!
>
> thanks, best regards
>
> mike


0 Kudos
Message 2 of 3
(3,543 Views)
Thanks for your reply. I allready knew that link, but i can't find anything about FieldPoint-Communication in a dll there.

Apart from this i don't want to use the dll anymore, cause i've started to create a c++-Application which communicates over DataSockets with the FieldPoint (I'm using the DirectX-Controls CWDataSocket and CWGraph).

I'm able to connect to my FieldPoint but i don't know how to read data from it:

I trap the OnDataUpdatedCwdatasocket-Event of the CWDataSocket. Unfortunately i don't know how to handle the Data. The only parameter of the event is a LPDISPATCH-Type. How can i get the data out of this type resp. how can i read the data direct from the CWDataSocket?
The only usefull method i can find in the DataSocket is get_data() which returns the same LPDISPATCH-Type as the event.

At ni.com i found an example in Visual Basic, which reads the data like this: CWDataSocket.Data.Value
Where can i find the corresponding functions in c++?

thanks, best regards

mike
0 Kudos
Message 3 of 3
(3,528 Views)