LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

7.1 dll string problem

Hi Everyone,
 
I have written a function in a DLL that has return type char *.  Here is the function:
 
__declspec(dllexport) char *getMixerName(unsigned int mixerIdx)
{
      MIXERCAPS     mixcaps;
      /* Get info about the next device */
      mixerGetDevCaps(mixerIdx, &mixcaps, sizeof(MIXERCAPS));

      return mixcaps.szPname;
}
 
All it does is return the name of the windows mixer at index mixerIdx.  In LV 8.2 I can call this function with mixerIdx = 1 and the string "Fireface 400 Analog (1+2)" is returned.  If I then do the same thing in LV 7.1, the function returns a string of garbage that won't even paste into this message. 
 
Has anyone seen this difference between LV 7.1 and 8.2?  I am using the same exact code (both DLL and the VI that calls the DLL) in both versions of LV and one works while the other does not.
 
          Thanks for your help,
          Zach
0 Kudos
Message 1 of 2
(2,444 Views)
Instead of using char *, you can use LStrHandle.  It's declared in extcode.h I think.
 
George Zou
 
George Zou
0 Kudos
Message 2 of 2
(2,436 Views)