NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

C dll can't define parameters

HI, crew!

 

I am a relative newbie, I have a dll file developed in C and set of definition files.  I can import it into test stand but it only picks up the functions not inputs / outputs.

I was told, that if I iknow the inputs and the outputs to each function - I could define them on my own it would work.  Well, I cannot get any reasonable output at all.  If anyone knows the secret (or is it even possible???) please help me out.

 

https://acroname.com/system/files/software/hubtool_win32_i386_17.zip - here is the link to the development .zip file, which has the Brainstem2.dll.

 

I also understand, that it uses the standard C libs which I don't have, so whne I tried importing the dll into labview through the import tool it fails also.

0 Kudos
Message 1 of 13
(3,281 Views)

DLL functions do need to be called in order to fully work.

 

from the TestStand Reference Manual:

If a DLL contains export information or if a DLL file contains a type library, the LabWindows/CVI and C/C++ DLL Adapters automatically populate the Function control on the Module tab of the step with all the function names exported from the DLL. In addition, when you select a function in the DLL, the adapter queries the export information or the type library for the parameter list information and displays it in the Parameter Table control on the Module tab. If the adapter cannot determine parameter information, you must enter the parameter information manually.

 

 

So I am not entirely certain where you heard that you can call a DLL without the function, but maybe they meant that you could manually enter the input/output information if it doesn’t show up automatically.

0 Kudos
Message 2 of 13
(3,252 Views)

So I am not entirely certain where you heard that you can call a DLL without the function, but maybe they meant that you could manually enter the input/output information if it doesn’t show up automatically.

------------------------------------------

 

Sorry for no being clear - that is what I meant.

 

p.s. one of the outputs of a dll is a pointer to a structure, I looked at the example in the TestStand on passing c structs and tried to go by that to no avail. 

0 Kudos
Message 3 of 13
(3,248 Views)

Perhaps this link will help explain this a little more.

0 Kudos
Message 4 of 13
(3,245 Views)

Thanks I saw this earlier, I will look into it further.  I know that I can write C++ wrappers, don't have the time for this though and we have a cpp developer assigned to this.  My goal is to validate the hardware in our set up.

In short, are you saying it's not possible to work with c-dlls by specifying my own inputs/outputs?

 

I have a back up plan to create python scripts, however I would rather do TS or LV.

0 Kudos
Message 5 of 13
(3,242 Views)

You should be doable to enter in the parameters. I'm going to look a little bit more into this later, but the first place I would check would be the TestStand reference manual, as it gives good insight on how to do these kinds of things manually.

0 Kudos
Message 6 of 13
(3,235 Views)

Hello,

 

I got around to looking inside of your zip file, and I noticed that there are a large number and variety of functions. Which ones are you trying, and what are the parameter inputs that you are entering into the module in TestStand? Screen shots of the data types being entered in TestStand would be also helpful.

 

 

0 Kudos
Message 7 of 13
(3,199 Views)

Thank you so much for trying to help.

I am looking to start with the simplest function aDiscover_FindFirstModule, which takes an enum input linkType (index 1 for USB and index 2 for TCP.IP) and returns a pointer to a struct linkSpec*. 

I have created the custom type linkType in teststand, as a container with all the inputs provided in the aDiscover.h

Below is the description of the function in the aDiscover.h header file (also can be found in that .zip)

 

  /// Function #aDiscovery_FindFirstModule

    /**
     * Finds the first module found on the given transport.
     *
     * \param type The transport type on which search for devices. Valid #linkType "linktypes" are accepted
     *
     * \return A pointer to the linkSpec for the requested module if found or NULL otherwise. This call
     *         Allocates memory that must be freed by a call to #aLinkSpec_Destroy.
     */
    aLIBEXPORT linkSpec* aDiscovery_FindFirstModule(const linkType type);

 

P.S.  I am just wondering conceptually - they are providing header files, yet they claim that they are still using stdio.h - a standard C library.  Is this the reason it's not working?

0 Kudos
Message 8 of 13
(3,191 Views)

When you create the container, dies it have numeric integers in them? What happens if you simply pass an integer value of 1 into the code? Do you receive error's or garbage data?

 

Is the result parameter configured return a pointer or handle? 

0 Kudos
Message 9 of 13
(3,155 Views)

When you create the container, dies it have numeric integers in them?

-yes of course - unsigned numeric integers 32 bit

What happens if you simply pass an integer value of 1 into the code?Do you receive error's or garbage data?

- since I don't know how to pass the error out of the dll (didn't see the error container defined)- nothing happens.  If I set the output to be a Pointer/Handle in the Return Value (a good reference) out

 

 

Is the result parameter configured return a pointer or handle? 

-linkSpec is configered to be a C Struct of custom type that I have defined passed by a pointer

 

 

p.s. Do you happen to know how to present the t.usb.usb_id part?

 

I have created a container inside my output container named it 't'

created another container inside of 't' named it usb

created a numeric unsigned integer 32 bit usb_id.

Is this right?

0 Kudos
Message 10 of 13
(3,133 Views)