All works well when I use a literal value in STRPTR eg STRPTR("HELLO"),
but when I try using a variable i.e
Code: Select all
DIM stVar AS STRING
stVar = "HELLO"
RETURN STRPTR(stVar) 'RETURN STRPTR("HELLO") does work though!!
then it does'nt work. Any ideas of why it is not.
Here is the function
Code: Select all
PUBLIC FUNCTION REPEAT CDECL ALIAS "REPEAT" (numTimes AS INTEGER,stRepeat AS ZSTRING PTR) AS ZSTRING PTR EXPORT
DIM AS STRING stTemp
stTemp = *stRepeat
DIM AS INTEGER counter,repeatLen
counter = 1
DO
stTemp = stTemp & stTemp
counter *= 2
LOOP WHILE (counter < numTimes)
repeatLen = numTimes * LEN(*stRepeat)
stTemp = LEFT(stTemp,repeatLen)
RETURN STRPTR(stTemp)
END FUNCTION
I use this dll in a liberty basic program like this :-
Code: Select all
CALLDLL #lib2,"REPEAT", n AS long, b$ AS PTR, result as long
print winstring(result)
I would really appreciate any help!
Code: Select all