12-01-2022 04:20 PM
I cannot get DAQmxWriteAnalogF64 - a function in NI's COM DLL for the DAQmx library - to work. I have successfully created and started a task and successfully created an analog output channel. However, I am not able to get the DAQmxWriteAnalogF64 to work. No matter what I do, it seems, I continue to get a return code of -200492 which is defined as the error DAQmxErrorCAPIReservedParamNotNULL. I am using a special language named APL implemented by Dyalog.com. It has C typing and COM DLL linking capabilities. I have been able to communicate with the USB-6001 correctly in all the other prerequisite functions. NI's trace function indicates everything is being passed correctly too, but returns that error. I have been told that all that should be necessary is passing a 4 byte unsigned integer with a value of 0 to satisfy the function's requirement for a Null Pointer. NI's documentation for the function specifies this for the 7th parameter required to operate the function:
reserved | bool32 * | Reserved for future use. Pass NULL to this parameter. |
12-08-2022 04:47 AM - edited 12-08-2022 04:50 AM
Your Dyalog software may actually create automatically a reference to that "NULL" integer to pass to that API, since it sees in the .Net Type-Library that this parameter is in fact a reference. You need to find out how to tell your Dyalog software that it needs to not promote this value to be a reference but instead pass that NULL as value. And if your Dyalog software is a 64-bit application (which according to its webpage it is) that pointer is not a 32-bit integer but really a 64-bit integer. Only the value it points to is a 32-bit integer interpreted as a boolean by that function.
Your Dyalog software should either have a keyword to not promote a value as reference or have a special reserved parameter constant or similar to indicate that it should pass a NULL IntPtr by value. Maybe something like IntPtr(0)?