b$ = test2()
PRINT b$, 100, 100
SHOWSCREEN
MOUSEWAIT
END
FUNCTION test2:
LOCAL a$
a$ = "HelloWorld"
RETURN a$
ENDFUNCTION
Why doesn't this work?
FUNCTION test2$:
Thanks, one other question, when exporting strings as a DLL is this correct?
EXPORT test2$
FUNCTION test2$:
LOCAL a$
a$ = "HelloWorld"
RETURN a$
ENDFUNCTION
Is this right? When dumping the DLL I get a function called test2_Str but when I call this function I get a crash. How are strings returned i.e. are they like "C" strings with a null "\0" terminator?
This is how I call it in powerbasic :-
DECLARE FUNCTION test2 CDECL LIB "test.dll" ALIAS "test2_Str" () AS STRING
FUNCTION PBMAIN () AS LONG
MSGBOX test2()
END FUNCTION
you receive a 100% C++ const char*