How to pass a parameter of type pointer to PVOID from LabView to DLL?
I'm calling a DLL written in C++ from LabView. The function prototype is开发者_Python百科:
ULONG DAQ_Open(PVOID *pHandle);
How can I pass the correct parameter from LabView? Is it just impossible to pass parameters of type pointer to pointer from LabView to DLL?
As long as you're not expecting to pass a pointer to a LabVIEW VI to use as a callback (which is a seperate, and much more difficult answer), the parameter is just a pointer. When you configure your call library node, use the type "numeric" and the data type "unsigned pointer-sized integer" and pass "pointer to value."
This should give you a prototype of: void funcName(uintptr_t *arg1);
For additional examples on calling DLLs from LabVIEW (including pointers, structs, arrays, etc), here's a handy article that links to several other in-depth examples: https://decibel.ni.com/content/docs/DOC-9076
You should search for 'dll pointers labview' on NI's website to get an idea. Also, there is an example shipped with LabVIEW called Call DLL.vi which has examples on how you can achieve this. The example VI can be found by navigating to Help -> Find Examples and then searching for DLLs.
the Call DLL.vi VI allows you to browse examples of external code (C and C++) data types and how they interface with LabVIEW. Each data type has an example VI that demonstates the use of the Call Library Function Node. To open the example VI for a particular data type, select that data type from the list on the left and then press the "Open Example VI for Current Data Type" button. The function prototype, the function's source code, and any specific details about this example will appear in the External Code Information cluster.
精彩评论