C_func problems...

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu