NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to auto-recognize the function parameters called from a DLL built by VC6.0

Hi,

I use Teststand 3.5 with C/C++ Adapter, and the DLL is built by VC6.0.
While I specify module for an action, the parameters of a function called from the DLL are not recognized.
Since I have the DLL source, I know I can select the source file and verify prototype in the "Source Code" Tab.
Under the way, almost parameters can be recognized, but some parameters, e.g. HANDLE or I definded, can not ( shows error message "The function definition cannot be found in the source file...").
How to recognise these parameters?


Thanks.

0 Kudos
Message 1 of 6
(6,096 Views)
Have you been able to get your DLL calls to work without pressing the "Verify Prototype..." button?
Since TestStand only has a few default datatypes, (string, boolean, numeric, and object reference), certain parameters types may not be able to match up - even though they should work in the TestStand environement.

If you create your function call properly (IE it matches the prototype in your dll) does the function call work? Or are you getting an error.

Let us know SCTseng, thanks!
Dan Weiland
Message 2 of 6
(6,075 Views)

Hi DWeiland,

Without pressing the "Verify Prototype..." button, the arguments of the DLL functions are only added manually. (popout "This function either does not have parameter information in the DLL or uses types not recognized by TestStand")

It is not flexible to add parameters everytime, so I found a solution in internet, ie. add dll source and press "verify prototype".

But, if the parameter is either HANDLE or other struct I defined, the problem can not be solved by the solution I found. (popout "The prototype in the source file is not valid.")

I think the problem is Teststand dose not recognize my dll parameter, the "Press verify prototype" action is only changing the prototype in the Module Tab.

Does a way to solve the probles? or another way to solve "This function either does not have parameter ...." problem?

Thanks

0 Kudos
Message 3 of 6
(6,042 Views)
Hi,

The problem you are running into is one that Dan mentioned - TestStand does not have enough native data types to recognize your struct. If TestStand does not recognize your prototype, you will have to manually define the prototype for it to function.

There is a shipping example that might help. It discusses passing a c struct in TestStand located in the <TestStand>\Examples\StructPassing\C\ folder where <TestStand> is the location where TestStand is installed on your system.


Matt Mueller
National Instruments
0 Kudos
Message 4 of 6
(6,032 Views)

The problem isn't that TestStand doesn't have enough native types. A handle can be represented in a TestStand numeric variable just fine. Instead, the issue is that when you select Verify Prototype, TestStand doesn't fully pre process your headers and compile your code to determine the types. To do so would require TestStand not only to be a full C/C++ compiler but it would also have to be able to read your compiler's projects and settings to resolve include paths, macros, etc.

Since TestStand is not a C/C++ compiler, it just looks for the standard basic data types plus a few more that are common in test code.  Other data types will not be automatically recognized even if they can be mapped to TestStand types.

Another option it to create a type library for your dll so that TestStand can automatically read the data type information from it. However, I don't know if that works for struct parameters and I looked for the document on devzone that explains how to do that in VC++ and it has been moved or deleted 😞

Maybe an AE would know of a link to a current document that describes how to do this?

Message 5 of 6
(6,019 Views)
James, you're right, a type library should work as well. I looked for the document you are referring to and apparently it is unavailable at the current time. As soon as it becomes available, I will post it here for reference.

In the meantime, you can check out this article from Microsoft, How To Create Constants and DLL Declarations in a Type Library.

Matt Mueller
National Instruments
0 Kudos
Message 6 of 6
(6,011 Views)