Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 ratings:
 4 out of 5     Rate this Document

Calling a C/C++ Function with a Void Pointer Parameter from TestStand

Primary Software: TestStand
Primary Software Version: 4.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I have a  C/C++ DLL that has a function declaration with a void pointer (void*) parameter. The C/C++ DLL adapter for the Action step does not allow me to choose void* from the list of types for this parameter. Can I still call this function from TestStand?

Solution:
TestStand does not allow you to explicitly specify a parameter as void*.

If the parameter is actually a struct, you will need to create a corresponding type that has struct passing enabled in order to ensure the correct packing.

If the parameter is actually a pointer, you can use a standard signed 32-bit integer (long*) in the TestStand Action step parameter configuration. If you are calling one function in your DLL that returns a handle to some memory location, and the you call another function that takes this handle, it will work as long as both functions are running in the same DLL/memory space. The long* you are passing by value will really be a 4 byte pointer, which the DLL can then use to get at what the original handle was pointing to.




Related Links:

Attachments:





Report Date: 12/04/2007
Last Updated: 12/07/2007
Document ID: 4G39D3SN

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit