Re: User32 And GDI32 Wrapper Feedback
- Posted by mattlewis (admin) Jul 19, 2012
- 1505 views
coconut said...
You can't pass a string to a WIN32 API function. Windows knows nothing about euphoria sequence. this should be something like that:
procedure WinHelp(atom handle,sequence str,atom ex,atom ex2) atom pStr pStr = allocate_string(str) c_proc(xWinHelp,{handle,pStr,ex,ex2}) free(pStr) end procedure
With euphoria 4.0, you can simplify this a bit so that you don't have to worry about memory management:
procedure WinHelp(atom handle,sequence str,atom ex,atom ex2) atom pStr c_proc(xWinHelp,{handle,allocate_string(str, 1),ex,ex2}) end procedure
Adding the extra 1 to the allocate_string() call causes the pointer to be freed once there are no more euphoria references to it.
Matt