05-07-2021 12:27 PM - edited 05-07-2021 01:01 PM
I'm trying to place a TDMS channel handle pointer in a header file and use it for functions in a few different c source files, but keep getting "Invalid channel handle." types of errors. Can TDMS objects be used in this manner?
My code works fine when the channel handle declaration is contained in one source file, but crashes when I try to break it out.
Header File Declaration:
extern TDMSChannelHandle * tdmsChannelHandle;
Source File Definition:
TDMSChannelHandle * tdmsChannelHandle = 0;
05-09-2021 07:39 AM - edited 05-09-2021 07:40 AM
Your post contains not enough information. The fact that you declare it as extern should not change the operation. That you initialize it to 0 without assigning a valid handle by opening successfully a TDMs file could be not the problem?
And as soon as you try to access that handle from multiple source code modules you have to make sure of course to assign a valid handle somewhere before you try to use it elsewhere!