22 lines
728 B
Plaintext
22 lines
728 B
Plaintext
Module CheckCCall {
|
|
mybuf$=string$(chr$(0), 1000)
|
|
a$="Hello There 12345"+Chr$(0)
|
|
Print Len(a$)
|
|
Buffer Clear Mem as Byte*Len(a$)
|
|
\\ copy to Mem the converted a$ (from Utf-16Le to ANSI)
|
|
Return Mem, 0:=str$(a$)
|
|
|
|
Declare MyStrDup Lib C "msvcrt._strdup" { Long Ptr}
|
|
Declare MyFree Lib C "msvcrt.free" { Long Ptr}
|
|
\\ see & means by reference
|
|
\\ ... means any number of arguments
|
|
Declare MyPrintStr Lib C "msvcrt.swprintf" { &sBuf$, sFmt$, long Z }
|
|
|
|
\\ Now we use address Mem(0) as pointer (passing by value)
|
|
Long Z=MyStrDup(Mem(0))
|
|
a=MyPrintStr(&myBuf$, "%s", Z)
|
|
Print MyFree(Z), a
|
|
Print LeftPart$(chr$(mybuf$), chr$(0))
|
|
}
|
|
CheckCCall
|