Keith Hutchison wrote:
Is this a correct way to send back a string from c ?
export char* _stdcall getCurrentRecordingDevice()
{
char deviceName[MIXER_SHORT_NAME_CHARS] = "null";
/*
processing to get name works.
*/
return deviceName ;
Don't you return a function local variable, which get's
released just after return from the function?
Isn't deviceName a local variable?
Keith
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Surely it is, but it will be allocated on the stack, that outside the
function scope will get any other values, and for sure it will not be a
value you can interprete as a string (if not for a fortunate coincidence).
It would be different if you declared the variable to be static: in that
case it would exist also outside the function scope.
Best Regards.
--
Alberto Paderno
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|