12-16-2010 08:30 AM
Hi all,
I'm trying to access a VI in a DLL build with Labview trough VI Server.
I copied some parameter in the initialisation file of an executable that worked to the .ini file of the dll. It seems that the dll doesn't load those parameter from the .ini file. If i activate Web server to connect trough debug application or shared library, it's work but not the VI Server.
Is somebody have already access a VI in a DLL trough VI Server?
Thanks
B.
12-16-2010 03:21 PM - edited 12-16-2010 03:22 PM
VI Server is started and controlled on behalve of the LabVIEW process (IDE or LabVIEW executable). A LabVIEW DLL does not have its own process context. Therefore the VI server is controlled by the LabVIEW executable ini file and barring that (because the loading application is not a LabVIEW process) not at all.
12-16-2010 03:27 PM
So how can I access to a VI using VI Server in a DLL?
12-17-2010 02:11 AM
Unless the VI in the DLL is called by a LabVIEW process, you can't in recent LabVIEW versions. Before LabVIEW 8.0 you could simply treat the DLL file like a LabVIEW Archive (LLB) and specify the path to the VI in such a way to your VI Server functions, but in LabVIEW 8.0 they disallowed such access to compiled VI resources inside exe's and dll's due to some überconscious concerns by some LabVIEW users that this allows others to steal their very precious IP out of compiled executables.
12-17-2010 07:31 AM
The VI is called by a labview process.
There is must be a way to activate VI Server in a VI that is inside a DLL.
12-17-2010 07:55 AM - edited 12-17-2010 07:57 AM
No, the VI Server is activated in the LabVIEW process not in the DLL. If the LabVIEW process has loaded the DLL AND it is the same version as the the LabVIEW version used to create the DLL, the DLL function is executed in the context of the LabVIEW process, otherwise in a seperate context of the according runtime engine. Still there is no simple way to access that VI inside the DLL over normal VI Server functionality. The LabVIEW process is for the most part oblivious about the fact, if the DLL is a C created DLL (or Delphi, or VB or whatever) or a LabVIEW DLL. It simply calls the function as a C function.
The compiled C stub which is called to instantiate the DLL function does detect if the calling process is a LabVIEW process with a compatible version and uses in that case the according LabVIEW runtime environment to execute the VI inside the DLL to gain some performance advantages, but that is about it. The only thing you SHOULD be able to do, is to connect a LabVIEW development environment to the debug interface of the DLL but that is although similar to VI Server not at all the same as VI Server.
This all said, it would help if you would elaborate what you really want to do. Some people here might be able to offer alternative ways to achieve your objective then, without you having to bang your head bloody on this brick wall.
03-24-2011 03:04 PM
rolfk a écrit :
No, the VI Server is activated in the LabVIEW process not in the DLL. If the LabVIEW process has loaded the DLL AND it is the same version as the the LabVIEW version used to create the DLL, the DLL function is executed in the context of the LabVIEW process, otherwise in a seperate context of the according runtime engine. Still there is no simple way to access that VI inside the DLL over normal VI Server functionality. The LabVIEW process is for the most part oblivious about the fact, if the DLL is a C created DLL (or Delphi, or VB or whatever) or a LabVIEW DLL. It simply calls the function as a C function.
The compiled C stub which is called to instantiate the DLL function does detect if the calling process is a LabVIEW process with a compatible version and uses in that case the according LabVIEW runtime environment to execute the VI inside the DLL to gain some performance advantages, but that is about it. The only thing you SHOULD be able to do, is to connect a LabVIEW development environment to the debug interface of the DLL but that is although similar to VI Server not at all the same as VI Server.
This all said, it would help if you would elaborate what you really want to do. Some people here might be able to offer alternative ways to achieve your objective then, without you having to bang your head bloody on this brick wall.
The only way i found to activate it, is to add code in the dll.
Here is an example on what to add to activate VI-Server from .ini file.