Re: Thread Local Storage
- Posted by ghaberek (admin) Feb 07, 2013
- 1588 views
petelomax said...
Huh, no takers I see
Actually I did get the functions wrapped, but I couldn't really figure out how it was supposed to work so I moved onto other things (as my lack of attention span often leads me). However, I am rather curious what you need this for...
include "std/dll.e" without warning public constant TLS_OUT_OF_INDEXES = #FFFFFFFF constant kernel32 = open_dll( "kernel32.dll" ), xTlsAlloc = define_c_func( kernel32, "TlsAlloc", {}, C_DWORD ), xTlsFree = define_c_func( kernel32, "TlsFree", {C_DWORD}, C_BOOL ), xTlsGetValue = define_c_func( kernel32, "TlsGetValue", {C_DWORD}, C_POINTER ), xTlsSetValue = define_c_func( kernel32, "TlsSetValue", {C_DWORD,C_POINTER}, C_BOOL ) public function TlsAlloc() return c_func( xTlsAlloc, {} ) end function public function TlsFree( atom dwTlsIndex ) return c_func( xTlsFree, {dwTlsIndex} ) end function public function TlsGetValue( atom dwTlsIndex ) return c_func( xTlsGetValue, {dwTlsIndex} ) end function public function TlsSetValue( atom dwTlsIndex, atom lpTlsValue ) return c_func( xTlsSetValue, {dwTlsIndex,lpTlsValue} ) end function
-Greg