LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1097 when calling void **

Solved!
Go to solution

Well, that is the job of the API documentation that comes with your driver. It will tell you how you need to interpret the data. That could be a variable stream of data where a header deescribes the format that follows, or it could depend entirely on the device you communicate with and the driver only transparently passes the data from or to the caller of the driver function.

Rolf Kalbermatter
My Blog
0 Kudos
Message 21 of 35
(1,700 Views)

Hi,

 

thanks rolfk,

 

well here is the snapshot of my code , I am getting the pointer address and I want the data stored at these address locations ,

 

stuck at this point....Smiley Sad

0 Kudos
Message 22 of 35
(1,683 Views)

This XAPI interface looks like .Net or ActiveX. The returned value from your GetBlock node is therefore a LabVIEW Refnum to an underlaying ActiveX or .Net data value object, not a memory pointer. If your XAPI is .Net you would probably have to use the .Net Object to Variant function in LabVIEW to convert the data value object refnum into a LabVIEW variant. ActiveX would be a lot more complicated.

Rolf Kalbermatter
My Blog
0 Kudos
Message 23 of 35
(1,673 Views)

Hi rolfk,

 

I tried the approach of Call Library function node to call the xapi.dll , issue is I am getting the error 1097 at the Getblock...

0 Kudos
Message 24 of 35
(1,638 Views)

Please find the screen shot attached...

0 Kudos
Message 25 of 35
(1,631 Views)

That's nice that you add a picture of the 1097 error. But it is as helpful for helping you as a screenshot of your favorite movie scene: not at all.

Error 1097 means that you have called a DLL function that did something during its execution that it is not allowed to do. Possble reasons in order of probablility:

 

1) Misconfigured Call Library Node (99% chance)

     - calling a function that expects a buffer to write into and you did not allocate (a large enough) buffer in the diagram before calling that function (my esitmate is that this is about 95% of the cases when someone not familiar with C programming tries to use the Call Library Node)

     - using the wrong number of parameters, wrong datatypes for one or more of the parameters or wrong calling convention (the remaining 4%)

2) A bug in the DLL (1% for commercially available DLLs, much higher for self developed DLLs)

 

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 26 of 35
(1,626 Views)

嗨,nathand!

 

您的解决方案很有帮助,但我仍然无法找到处理类似问题的正确方法。我在论坛中有了一个新主题,我特别希望能从你那里得到一些帮助。非常感谢你,如果你可以在帖子中查看我的问题(https://forums.ni.com/t5/LabVIEW/error-code-1097-calling-dll-including-void/mp/3856302)以下: 

 

我是LabVIEW的初学者,我正在尝试设置我从CAEN购买的桌面数字转换器。数字化仪的型号为DT5743。我已经能够使用CAEN中的dll成功地使用c和c ++中的数字化仪。现在我想在LabVIEW中实现相同的代码(我使用的是2015版)。

 

我已经使用“导入共享库”功能从dll创建VI,并且我构建的大多数vi工作正常。只有两个有问题。他们都使用“void **”。它们的函数声明是:

 

CAEN_DGTZ_AllocateEvent(int handle,void ** Evt);

CAEN_DGTZ_DecodeEvent(int handle,char * evtPtr,void ** Evt);

 

它们用于为缓冲区分配内存以包含事件和解码事件。

 

可能出错的唯一变量是“void **”声明的Evt。函数隐藏在dll中,只有原型在h文件中可用。而Evt的结构如下:

 

CAEN_DGTZ_X743_EVENT_t *活动;

 

typedef struct
{
uint8_t GrPresent [8];
CAEN_DGTZ_X743_GROUP_t DataGroup [8];
} CAEN_DGTZ_X743_EVENT_t;

 

typedef struct
{
uint32_t ChSize;
float * DataChannel [2];
uint16_t TriggerCount [2];
uint16_t TimeCount [2];
uint8_t EventId;
uint16_t StartIndexCell;
uint64_t TDC;
浮动PosEdgeTimeStamp;
float NegEdgeTimeStamp;
uint16_t PeakIndex;
浮峰;
浮动基线;
浮充;

} CAEN_DGTZ_X743_GROUP_t;

 

我试图将参数设置为“C string Pointer”和“Adapt to type”但它们不起作用,它们都有错误1097。

 

那么如何在labview中调用void **来成功使用这两个函数呢?

Download All
0 Kudos
Message 27 of 35
(1,460 Views)

I'm not understanding Chinese but the API you have really, and I mean very very REALLY, requires you to write a wrapper DLL in C for this. Trying to directly interface to this type of API is insane!

 

C String Pointer is definitely the completely wrong type to pass to. More likely you might get away by passing in a pointer sized integer passed by reference (as pointer) but without detailed documentation about these APIs it's impossible to say if that would work. It would requite the Allocate Event to allocate the structure in memory and ther would need to be an according DeallocateEvent() function. And you won't really have an easy way to look into the variables inside that structure in LabVIEW. But without knowing the exact API documentation, this is all guess work anyways, and without proper C programming knowledge a pretty impossible task to do for sure.

Rolf Kalbermatter
My Blog
0 Kudos
Message 28 of 35
(1,449 Views)

I am so sorry that my reply in English has been incorrectly translated to Chinese by my google translater(╥_╥). And your suggestion is very helpful. Thanks very much!

0 Kudos
Message 29 of 35
(1,442 Views)

Hi, rolfk!

 

Thank you for helping me last time even I used Chinese accidentally(`・ω・´). 

 

I have tried to create a wrapper DLL in C, but when I was converting it to VIs in LabVIEW, I met some trouble.

 

I use Visual Studio 2013 to export the dll and then use the "Import Shared Library" function in LabVIEW 2015(32-bit), but the struct that I have defined in .h files can't be found correctly. Here is the error report(take the function "OpenDigitizers" for example):

 

ERROR_CODES_t OpenDigitizers(WaveDemoConfig_t *WDcfg);   //Function declaration

 

The following symbols are not defined: WaveDemoConfig_t;

Undefined symbols can prevent the wizard from recognizing functions and parameters. To correct this problem, check the header file to determine if you must add preprocessor definitions. Click the Back button to return to the previous page of the wizard to add a preprocessor definitionsl (for example, "NIAPI_stdcall = __stdcall" or "NIAPIDefined = 1").

 

I have defined this WaveDemoConfig_t struct in the corresponding header file, however it can't be recognized. How can I solve this problem?

 

Thanks again for your help last time! Cause I am a beginner using LabVIEW, I'm very grateful to you for your help. 

 

 

0 Kudos
Message 30 of 35
(1,415 Views)