Posted: Sat Aug 18, 2007 5:09 pm
Well, it does. Of course the pseudotype is necessary (else I wouldn't have included it), but it does work. Just don't pass a combined string (a+b) to the procedure.Except that it doesn't
http://www.purebasic.com
https://www.purebasic.fr/english/
Well, it does. Of course the pseudotype is necessary (else I wouldn't have included it), but it does work. Just don't pass a combined string (a+b) to the procedure.Except that it doesn't
You didn't use a pseudotype you used a normal string type (.s).Trond wrote:Well, it does. Of course the pseudotype is necessary (else I wouldn't have included it), but it does work. Just don't pass a combined string (a+b) to the procedure.Except that it doesn't
Code: Select all
Procedure Callback(FileAddress.l)
Debug PeekL(FileAddress) ; Guaranteed to be different for each file
Debug PeekS(PeekL(@FileAddress))
EndProcedure
Prototype ProtoCallbackInterface(FileAddress.s)
Function.ProtoCallbackInterface = @Callback()
string.s = "foo"
Debug "@string = " +Str(@string)
Debug "@"+Chr(34)+"foo"+Chr(34)+" = "+Str(@"foo")
Debug "Result of Function(string)"
Function(string)
Debug "Result of Function(@"+Chr(34)+"foo"+Chr(34)+")"
Function("foo")
Code: Select all
@string = 9045608
@"foo" = 4280824
Result of Function(string)
7274598
foo
Result of Function(@"foo")
7274598
foo
Code: Select all
*foo.c = Function("foo")
Debug "*foo = "+Str(*foo)
Debug PeekS(*foo)
Code: Select all
Procedure Callback(FileAddress.l)
Debug FileAddress ; Guaranteed to be different for each file
Debug PeekS(FileAddress)
EndProcedure
Prototype ProtoCallbackInterface(FileAddress.s)
Function.ProtoCallbackInterface = @Callback()
string.s = "Hello"
Debug @string
Function(string)
Debug "---"
Function(#PB_Compiler_File)
Take a look at the generated assembly code to see what PureBasic is doing.PureBasic is copying the string data to the local variable.