06-23-2005 01:08 PM
06-23-2005 05:00 PM
@lvEngineer2005 wrote:
We are implementing DSNewHandle() from labview.lib in our COM server. After calling the method successfully for a few times, we cannot make the call anymore. There is a message box telling us that it's a fatal error: Labview.lib was not called from a Labview process.
What should we do to resolve this problem?
Best regards,
06-24-2005 08:23 AM
06-24-2005 09:39 AM
@lvEngineer2005 wrote:
That is, we need to get a pointer of TD1Hdl(created by labview) out off one of our labview DLL directly. We follow a sample LV_string_array.zip which introduces us to DSNewHandle and Labview.lib.
Could you help me resolve this issue one way or another? We really need feature that works.
Best Regards,
06-24-2005 11:22 AM
06-09-2010 08:59 AM
Hi;
I am having exactly the same problem as yours. I am wondering if you managed to solve this problem.If yes, could you possibly post it?
Kind Regards
06-09-2010 09:35 AM - edited 06-09-2010 09:36 AM
You can NOT use labview.lib in an ATL project!
The process trying to call functions from labview.lib has to be started as a LabVIEW process! There is no other way. If your COM Automation server is an in process ActiveX DLL and always will be used inside a LabVIEW program or executable, then there is no problem, but if the ActiveX component is used by a different application you get that error. This is because labview.lib does not implement those functions but simply tries to link back to the LabVIEW kernel, which is not there if the calling process is not a LabVIEW process.
I'm really wondering why you think you need LabVIEW handles in a process that is not invoked as a LabVIEW process (development system or executable).
06-09-2010 10:06 AM
Hi Rolf;
In my TCP-IP server client application, I have a client vi that I converted into three Labview dlls; initialize, read and close. I am calling read.dll in a while loop in c++. The read dll is supposed to output an array (I attached a picture of it along with its header file created by Labview). According to header file, this dll outputs TD1 structure;
typedef struct {
int32_t dimSizes[2];
double Numeric[1];
} TD1;
typedef TD1 **TD1Hdl;
and on the c++ side, I am using the following line
TD1Hdl handle_var;
handle_var = (TD1**)DSNewHandle(sizeof(TD1));
but right at the line where I call DSNewHandle() function , I am getting the following error:
Labview.lib wan not called from a Labview process.
I created my project from scratch on my machine and I mass compiled but the problem still persists. I am wondering if you have any idea what the problem could be?
Thank you so much!
06-09-2010 01:52 PM - edited 06-09-2010 01:53 PM
Well that is not gonna work. The LabVIEW DLL is called inside its own LabVIEW runtime context since it does need a LabVIEW runtime kernel and your application is not a LabVIEW process and therefore does not have the necessary runtime kernel. Somehow the LabVIEW DLL contains code that detects if the DLL is called from a LabVIEW process that is the same version than the DLL was compiled in. If that is the case the DLL is loaded into that process and executed in process directly. If the LabVIEW versions do not match or the calling process is not a LabVIEW process, the DLL spawns a LabVIEW runtime process and loads the DLL into that context. It then sets up a marshalling stub similar to what ActiveX does for out of process automation servers and marshals all parameters between the calling process and the actual DLL runtime process.
So your non-LabVIEW process has absolutely no way of linking into the seperate out of process LabVIEW kernel in which the DLL executes. At least I do not know of any way, maybe there would be a way, but I doubt it and it certainly doesn't seem to be documented. Most likely if there would be, it would also very much depend on the actually used LabVIEW version in which you created the DLL.
Your only documented and sure to work solution is to not use LabVIEW native datatypes but standard C types instead.
06-09-2010 01:58 PM - edited 06-09-2010 01:59 PM