Get the array of unknown size of the CVI code module

I'm creating a type custom for my client, and I've encountered a problem that I'm not sure how to solve.

Here's the situation:

We have a custom step in which the main code is executed within a step after step. The code acquires samples of an instrument, but it is unclear how many samples will be returned. The CVI function has a table, the size of this table and an output parameter that indicates how many samples have been returned as parameters.

void AcquireSamples (double* samples, int samplesBufferSize, int *numSamplesRetrieved)

The goal is to have the array returned by the size of the number of samples taken.

I tried several ways, none of which works completely. The problem is that, as described here, TestStand creates a temporary table to move to the code module. but it does not resize the TestStand array property. So I need to manually resize the properties of the table, and I did not understand an elegant way to do it.

It would be easy if I had to create just a not, because I could use expressions after. I'm creating a type but I don't have that luxury (my code should allow the customer to enter expressions of post, but I run the risk of my client, removing any expression after default I get home).

First question:

I noticed when I was creating a stage with a CVI code module, that additional results allowed me to specify logging in both settings [in] and [out]. This I extrapolated that the parameter expression was evaluated before calling the function both again after the call to the function. I did some tests, and it doesn't seem to work that way.

(1) this is expected behavior? I don't see it documented anywhere, if can I rely on it remains the same in future versions of TestStand?

I used this behavior to my advantage to create an expression that does what I need an an step code module. But it does not work for a module of code to a later stage.

I did a small test DLL file and sequence illustrates my problem. I tried to document the file in sequence to show where I'm stuck. You will need to put the DLL in one of your directories to search for the type of custom work.

Any help would be greatly appreciated!

I think the problem is that the C programming language does not provide enough information for a caller to know the size of an output table in any kind of standard. I recommend again, you pass a CAObjHandle which is the variable of array instead and set the table directly using CA_Array1DToSafeArray() to create a safearray and SetValVariant on the propertyobject which is the property of the table to set the table. Don't forget to free the array (using CA_SafeArrayDestroy()) that you created with CA_Array1DToSafeArray after that SetValVariant call to avoid leaks.

Hope this helps,

-Doug

Tags: NI Software

Similar Questions

Maybe you are looking for

  • New Ipod Touch does not illuminate

    Buy IPod Touch last summer (August 2015) and died this morning. Can not activate it or it will load. Any suggestions?

  • Satellite M60 - cannot access the HARD disk but update the BIOS

    Hello I want to update the bios on a Satellite M60the problem is that I can't access either on my hard drive it still reboot So, first I want to try to update my Bios but as I can't work with windos XP I need to do it with a Dos command. is there any

  • How can I fix error 1326 install Quicken 2013 in Windows 8

    I'm running Windows 8 and I get the following error message (verbatim) when I try to install Quicken 2013 (or re-install Quicken 2012) _______________________________________________________________________________________________________ Quicken Fai

  • using door magic memmory stick in OS windows 7

    Y at - it a pilot to use door magic memmory stick in OS windows 7

  • DirectX 11 to 10?

    I have a compatible with DirectX10 video card, but my system has directx11.  I'm having trouble with the video rendering.  Is that what the problem and how do I save up to version 10?