Pointers in extern DLL functions

Xavi ____nospam at nospam.com
Fri Dec 21 19:21:29 PST 2007


Hi all, 

I have a doubt, for example; is safe to send the pointer returned by toUTF16z() to a DLL extern function like in this code? 
Can the GC delete it while the extern function is running? Do I need to keep it in a variable to avoid its deletion?

capCreateCaptureWindowW(toUTF16z(title), 0, 0, 0, 0, 0, hwnd, 0); 


And in this code using a cast? Is there any possible problem here? 

SendMessageW(hwnd, 0, 0, cast(uint)toUTF16z(file)); 


Or do I need to code it this way keeping it in "wfile"? 

wchar *wfile = toUTF16z(file); 
SendMessageW(hwnd, 0, 0, cast(uint)wfile); 

Thank you, cheers, 

Xavi



More information about the Digitalmars-d-learn mailing list