C_func problems...
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 25, 2004
- 567 views
Can anybody tell me why the following code has a machine-level exception error when run? The relevant msdn entry is here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createmutex.asp Very frustrating...
constant NULL = -1 include dll.e include machine.e constant kernel32 = open_dll("kernel32") --HANDLE CreateMutex( -- LPSECURITY_ATTRIBUTES lpMutexAttributes, -- BOOL bInitialOwner, -- LPCTSTR lpName --); constant xCreateMutex = define_c_func(kernel32, "CreateMutexA", {C_POINTER, C_CHAR, C_POINTER}, C_INT ) function createMutex(sequence name) atom ret, str str = allocate_string(name) ret = c_func(xCreateMutex, {NULL, 0, str}) free(str) return ret end function ? createMutex("testing")
-- MrTrick