LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL and sending arguments

My question will probably show that I am very ignorant of DLL's but here goes. I have been playing with the simple.cws program supplied with CVI 8.0 (.../samples/dll/simple.cvi/simple.cws). The two provide functions (MyDLLStdcallFunction and MyDLLCdeclFunction) seem to have the same functionality (print the argument string received from the aplication in the DLL  and return a integer vaiue to the apllciation). Both seem obtain an argument from the application allthough they are defined as  "DLLEXPORT" in the function declaration (are there equivalent "DLLIMPORT" functions ?). I obviously looked at the help function in CVI but this did not really help me.
 
Now my questions, how do I pass differnt arguments (doubles, pointers, even structures perhaps) to and from a DLL. I attempted to change  (LPSTR buffer) to (double doublevariable) but this does not work. The supplied functions seem to only allow a string to be passed from the application to the DLL and not the other way around. Any suggestions to modify this project so that I can  send different data types to and from the application to DLL will be appreciated.
 
Regards

Erik Wegman
(South Africa)
0 Kudos
Message 1 of 2
(2,963 Views)
Erik,
 
Yes, your assumption was correct about those two functions. They perform exactly the same task, except that they have different calling conventions.
 
For your specific question, you need to change the function itself in the .c file and the prototype in the .h file. In this case, it'd be mydll.c and mydll.h. Of course, make sure you recompile Mydll so the .lib file gets updated.
Regards,

Song Du
Systems Software
National Instruments R&D
0 Kudos
Message 2 of 2
(2,935 Views)