09-19-2016 04:07 AM - edited 09-19-2016 04:11 AM
Hi all,
There are two DLLs name "QMSL_WLAN_Transport.dll" and "QCAMSL_MSVC10R.dll" ,and some c++ codes to connect to DUT. The two DLLs work together to communicaite with DUT.
I am confused that how to use Call Library Function node to load the function in "QCAMSL_MSVC10R.dll" like
g_hResourceContext = QLIB_ConnectServer_UserDefinedTransport((HANDLE) USER_HANDLE, UserDefinedSend, UserDefinedReceive, UserDefinedFlushTxRx, true, true);
It seems that " UserDefinedReceive,UserDefinedSend,UserDefinedFlushTxRx " are Processaddress? And "UserDefinedReceive,UserDefinedSend,UserDefinedFlushTxRx" are functions in "QMSL_WLAN_Transport.dll"
UserDefinedReceive = (_UserDefinedReceive)GetProcAddress(hUDT,"UserDefinedReceive"); UserDefinedSend = (_UserDefinedSend)GetProcAddress(hUDT,"UserDefinedSend"); UserDefinedFlushTxRx = (_UserDefinedFlushTxRx)GetProcAddress(hUDT,"UserDefinedFlushTxRx");
Attached DLLs and C++ code snippets.
Needs help.
Thanks.
Solved! Go to Solution.
09-19-2016 04:21 AM
Read this http://digital.ni.com/public.nsf/allkb/DCB90714981A1F148625731E00797C33
09-19-2016 06:06 PM
Those parameters are callbacks - pointers to functions which are called by the DLL - and there's no way to duplicate that purely in LabVIEW. Search this forum for the word "callback" and you'll find similar questions (for other DLLs). You'll need to write your own DLL (in C, C++, etc) that implements those functions and provides a way to transfer data back to LabVIEW.
09-19-2016 08:29 PM
Thank you. I get it.
09-19-2016 08:31 PM
Thanks.
I am new to callback functions, maybe i should try another way.
09-20-2016 08:49 AM
Well if what you describe here would be all that you need to do in terms of callback pointers, then it could be done fairly easily in LabVIEW. However I'm afraid that this is just the tip of the iceberg and you will end up with much more of this and possibly even more complicated stuff. If that would be the case, I definitely would advocate the creation of an additional DLL in C, which wraps this one and provides a more LabVIEW friendly Call Library Node interface.
For the little you have shown, the attached project would be actually all that is needed to make this work. Just remember, I created this quick and dirty and had no way of testing it in any way. Also the header file you show does leave various things unspecified such as the calling convention of the functions and other things. So I simply assumed the Visual C defaults for these things.
09-20-2016 09:44 PM
A pretty good example.
Thank you rolfk.
rolfk 已写:Well if what you describe here would be all that you need to do in terms of callback pointers, then it could be done fairly easily in LabVIEW. However I'm afraid that this is just the tip of the iceberg and you will end up with much more of this and possibly even more complicated stuff. If that would be the case, I definitely would advocate the creation of an additional DLL in C, which wraps this one and provides a more LabVIEW friendly Call Library Node interface.
For the little you have shown, the attached project would be actually all that is needed to make this work. Just remember, I created this quick and dirty and had no way of testing it in any way. Also the header file you show does leave various things unspecified such as the calling convention of the functions and other things. So I simply assumed the Visual C defaults for these things.