Open GoogleCodeExporter opened 9 years ago
zeroPtr has changed a bit recently, I need to double-check what happened.
Ideally, there should be a better way to specify the calling signature of an
external C function.
One thing you might try as an experiment is to declare the 'buffer' argument as
'optional Address[ubyte]', so that the compiler will let you pass 'null'
directly. (Although I'm not sure that 'optional' works with Address - I'll have
to check.)
Original comment by viri...@gmail.com
on 7 Dec 2010 at 5:49
Great hint! Thank you.
With correct signature
@Extern("GetUserNameW")
def GetUserNameW(buffer:optional Address[uint16], size: Address[uint32]) ->
int32;
I am able to call the function as follows
var size: uint32 = 0;
if GetUserNameW(null, addressOf(size)) != 0 {
cerr.writeLn("Problem 1");
}
and get the expected result :-)
Original comment by kai.na...@gmail.com
on 7 Dec 2010 at 6:27
Original issue reported on code.google.com by
kai.na...@gmail.com
on 7 Dec 2010 at 5:44