crt

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 23 Imported by: 4

README

crt

Package crt provides C-runtime services. (Work In Progress)

Installation

$ go get modernc.org/crt

Documentation: godoc.org/modernc.org/crt

Documentation

Overview

Package crt provides C-runtime services. (Work In Progress)

Index

Constants

View Source
const (
	Tpthread_cond_t      = "" /* 196-byte string literal not displayed */
	Tpthread_mutexattr_t = "union{__size [4]int8,__align int32}"
)
View Source
const (
	Tpthread_attr_t  = "union{[56]int8,int64}"
	Tpthread_mutex_t = "" /* 201-byte string literal not displayed */
)
View Source
const (
	TCRITICAL_SECTION    = "struct{*struct{},int32,int32,*struct{},*struct{},uint64}"
	TFILETIME            = "struct{uint32,uint32}"
	TLARGE_INTEGER       = "union{struct{uint32,int32},struct{uint32,int32},int64}"
	TSECURITY_ATTRIBUTES = "struct{uint32,*struct{},int32}"
	TSYSTEM_INFO         = "struct{union{uint32,struct{uint16,uint16}},uint32,*struct{},*struct{},uint64,uint32,uint32,uint32,uint16,uint16}"
	TSYSTEMTIME          = "struct{uint16,uint16,uint16,uint16,uint16,uint16,uint16,uint16}"
	THMODULE             = "struct{int32}"
	TOSVERSIONINFOA      = "struct{uint32,uint32,uint32,uint32,uint32,[128]int8}"
	TOSVERSIONINFOW      = "struct{uint32,uint32,uint32,uint32,uint32,[128]uint16}"
	TOVERLAPPED          = "struct{uint64,uint64,union{struct{uint32,uint32},*struct{}},*struct{}}"
)
View Source
const Ttm = "struct{int32,int32,int32,int32,int32,int32,int32,int32,int32}"

Variables

This section is empty.

Functions

func CString

func CString(s string) unsafe.Pointer

CString allocates a C string initialized from s.

func Calloc

func Calloc(size int) (unsafe.Pointer, error)

Calloc is like Malloc except the allocated memory is zeroed. Calloc is safe for concurrent use by multiple goroutines.

func CopyBytes

func CopyBytes(dst unsafe.Pointer, src []byte, addNull bool)

CopyBytes copies src to dest, optionally adding a zero byte at the end.

func CopyString

func CopyString(dst unsafe.Pointer, src string, addNull bool)

CopyString copies src to dest, optionally adding a zero byte at the end.

func Free

func Free(ptr unsafe.Pointer) error

Free deallocates memory. The argument of Free must have been acquired from Calloc or Malloc or Realloc. Free is safe for concurrent use by multiple goroutines.

func GoBytesLen

func GoBytesLen(s *int8, len int) []byte

GoBytesLen returns a []byte copied from a C char* string s having length len bytes.

func GoString

func GoString(s *int8) string

GoString returns a string from a C char* null terminated string s.

func GoStringLen

func GoStringLen(s *int8, len int) string

GoStringLen returns a string from a C char* string s having length len bytes.

func GoUTF16String

func GoUTF16String(s unsafe.Pointer) string

TODO: implement a generic wide string variant of this GoUTF16String converts a wide string to a GOString using windows-specific implementations in go's syscall package

func Malloc

func Malloc(size int) (unsafe.Pointer, error)

Malloc allocates size bytes and returns a byte slice of the allocated memory. The memory is not initialized. Malloc panics for size < 0 and returns (nil, nil) for zero size. Malloc is safe for concurrent use by multiple goroutines.

func Movemem

func Movemem(dest, src unsafe.Pointer, n int) int

Movemem copies n bytes from memory area src to memory area dest. The memory areas may overlap: copying takes place as though the bytes in src are first copied into a temporary array that does not overlap src or dest, and the bytes are then copied from the temporary array to dest.

func P2U

func P2U(p unsafe.Pointer) uintptr

P2U returns the uintptr value represented by p. If p was obtained by U2P then the uintptr value originally passed to U2P is returned. Otherwise the return value is uintptr(p).

The function is safe for concurrent use by multiple goroutines.

func Realloc

func Realloc(tls *TLS, ptr unsafe.Pointer, size int) (unsafe.Pointer, error)

Realloc changes the size of the memory allocated at ptr to size bytes or returns an error, if any. The contents will be unchanged in the range from the start of the region up to the minimum of the old and new sizes. If the new size is larger than the old size, the added memory will not be initialized. If ptr is nil, then the call is equivalent to Malloc(size), for all values of size; if size is equal to zero, and ptr is not nil, then the call is equivalent to Free(ptr). Unless ptr is nil, it must have been returned by an earlier call to Malloc, Calloc or Realloc. If the area pointed to was moved, a Free(ptr) is done. Relloc is safe for concurrent use by multiple goroutines.

func RegisterHeap

func RegisterHeap(h unsafe.Pointer, n int64)

RegisterHeap registers the sbrk-style heap.

func TODO

func TODO(msg string, more ...interface{}) string

TODO remove me.

func U2P

func U2P(u uintptr) unsafe.Pointer

U2P returns unsafe.Pointer(&u).

The function is safe for concurrent use by multiple goroutines.

func UsableSize

func UsableSize(p unsafe.Pointer) int

UsableSize reports the size of the memory block allocated at p, which must have been acquired from Calloc, Malloc or Realloc. The allocated memory block size can be larger than the size originally requested from Calloc, Malloc or Realloc.

func VAFloat64

func VAFloat64(ap *[]interface{}) float64

func VAInt32

func VAInt32(ap *[]interface{}) (v int32)

func VAInt64

func VAInt64(ap *[]interface{}) (v int64)

func VALong

func VALong(ap *[]interface{}) int64

func VAOther

func VAOther(ap *[]interface{}) (v interface{})

func VAPointer

func VAPointer(ap *[]interface{}) (r unsafe.Pointer)

func VAULong

func VAULong(ap *[]interface{}) uint64

func VAUint32

func VAUint32(ap *[]interface{}) (v uint32)

func VAUint64

func VAUint64(ap *[]interface{}) (v uint64)

func XAreFileApisANSI

func XAreFileApisANSI(tls *TLS) int32

//sys: BOOL AreFileApisANSI();

func XCloseHandle

func XCloseHandle(tls *TLS, hObject unsafe.Pointer) int32

//sys: BOOL CloseHandle(HANDLE hObject);

func XCreateFileA

func XCreateFileA(tls *TLS, lpFileName *int8, dwDesiredAccess uint32, dwShareMode uint32, lpSecurityAttributes *XSECURITY_ATTRIBUTES, dwCreationDisposition uint32, dwFlagsAndAttributes uint32, hTemplateFile unsafe.Pointer) unsafe.Pointer

//sys: HANDLE CreateFileA(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);

func XCreateFileMappingA

func XCreateFileMappingA(tls *TLS, hFile unsafe.Pointer, lpAttributes *XSECURITY_ATTRIBUTES, flProtect uint32, dwMaximumSizeHigh uint32, dwMaximumSizeLow uint32, lpName *int8) unsafe.Pointer

//sys: HANDLE CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCTSTR lpName);

func XCreateFileMappingW

func XCreateFileMappingW(tls *TLS, hFile unsafe.Pointer, lpAttributes *XSECURITY_ATTRIBUTES, flProtect uint32, dwMaximumSizeHigh uint32, dwMaximumSizeLow uint32, lpName *uint16) unsafe.Pointer

//sys: HANDLE CreateFileMappingW(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName);

func XCreateFileW

func XCreateFileW(tls *TLS, lpFileName *uint16, dwDesiredAccess uint32, dwShareMode uint32, lpSecurityAttributes *XSECURITY_ATTRIBUTES, dwCreationDisposition uint32, dwFlagsAndAttributes uint32, hTemplateFile unsafe.Pointer) unsafe.Pointer

//sys: HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);

func XCreateMutexW

func XCreateMutexW(tls *TLS, lpMutexAttributes *XSECURITY_ATTRIBUTES, bInitialOwner int32, lpName *uint16) unsafe.Pointer

//sys: HANDLE CreateMutexW(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName);

func XDeleteCriticalSection

func XDeleteCriticalSection(tls *TLS, lpCriticalSection *XCRITICAL_SECTION)

//sys: void DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection);

func XDeleteFileA

func XDeleteFileA(tls *TLS, lpFileName *int8) int32

//sys: BOOL DeleteFileA(LPCTSTR lpFileName);

func XDeleteFileW

func XDeleteFileW(tls *TLS, lpFileName *uint16) int32

//sys: BOOL DeleteFileW(LPCWSTR lpFileName);

func XEnterCriticalSection

func XEnterCriticalSection(tls *TLS, lpCriticalSection *XCRITICAL_SECTION)

//sys: void EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection);

func XFlushFileBuffers

func XFlushFileBuffers(tls *TLS, hFile unsafe.Pointer) int32

//sys: BOOL FlushFileBuffers(HANDLE hFile);

func XFlushViewOfFile

func XFlushViewOfFile(tls *TLS, lpBaseAddress unsafe.Pointer, dwNumberOfBytesToFlush uint64) int32

//sys: BOOL FlushViewOfFile(LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush);

func XFormatMessageA

func XFormatMessageA(tls *TLS, dwFlags uint32, lpSource unsafe.Pointer, dwMessageId uint32, dwLanguageId uint32, lpBuffer *int8, nSize uint32, Arguments *[]interface{}) uint32

//sys: DWORD FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPTSTR lpBuffer, DWORD nSize, va_list* Arguments);

func XFormatMessageW

func XFormatMessageW(tls *TLS, dwFlags uint32, lpSource unsafe.Pointer, dwMessageId uint32, dwLanguageId uint32, lpBuffer *uint16, nSize uint32, Arguments *[]interface{}) uint32

//sys: DWORD FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPCWSTR lpBuffer, DWORD nSize, va_list* Arguments);

func XFreeLibrary

func XFreeLibrary(tls *TLS, hModule *XHMODULE) int32

//sys: BOOL FreeLibrary(HMODULE hModule);

func XGetCurrentProcessId

func XGetCurrentProcessId(tls *TLS) uint32

//sys: DWORD GetCurrentProcessId();

func XGetCurrentThreadId

func XGetCurrentThreadId(tls *TLS) uint32

DWORD WINAPI GetCurrentThreadId(void);

func XGetDiskFreeSpaceA

func XGetDiskFreeSpaceA(tls *TLS, lpRootPathName *int8, lpSectorsPerCluster *uint32, lpBytesPerSector *uint32, lpNumberOfFreeClusters *uint32, lpTotalNumberOfClusters *uint32) int32

//sys: BOOL GetDiskFreeSpaceA(LPCTSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);

func XGetDiskFreeSpaceW

func XGetDiskFreeSpaceW(tls *TLS, lpRootPathName *uint16, lpSectorsPerCluster *uint32, lpBytesPerSector *uint32, lpNumberOfFreeClusters *uint32, lpTotalNumberOfClusters *uint32) int32

//sys: BOOL GetDiskFreeSpaceW(LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);

func XGetFileAttributesA

func XGetFileAttributesA(tls *TLS, lpFileName *int8) uint32

//sys: DWORD GetFileAttributesA(LPCTSTR lpFileName);

func XGetFileAttributesExW

func XGetFileAttributesExW(tls *TLS, lpFileName *uint16, fInfoLevelId int32, lpFileInformation unsafe.Pointer) int32

//sys: BOOL GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation);

func XGetFileAttributesW

func XGetFileAttributesW(tls *TLS, lpFileName *uint16) uint32

//sys: DWORD GetFileAttributesW(LPCWSTR lpFileName);

func XGetFileSize

func XGetFileSize(tls *TLS, hFile unsafe.Pointer, lpFileSizeHigh *uint32) uint32

//sys: DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);

func XGetFullPathNameA

func XGetFullPathNameA(tls *TLS, lpFileName *int8, nBufferLength uint32, lpBuffer *int8, lpFilePart **int8) uint32

//sys: DWORD GetFullPathNameA( LPCTSTR lpFileName, DWORD nBufferLength, LPTSTR lpBuffer, LPTSTR* lpFilePart);

func XGetFullPathNameW

func XGetFullPathNameW(tls *TLS, lpFileName *uint16, nBufferLength uint32, lpBuffer *uint16, lpFilePart **uint16) uint32

//sys: DWORD GetFullPathNameW( LPCWSTR lpFileName, DWORD nBufferLength, LPCWSTR lpBuffer, LPCWSTR* lpFilePart);

func XGetLastError

func XGetLastError(tls *TLS) uint32

DWORD WINAPI GetLastError(void);

func XGetProcAddress

func XGetProcAddress(tls *TLS, hModule *XHMODULE, lpProcName *int8) func(*TLS) int64

//sys: FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);

func XGetProcessHeap

func XGetProcessHeap(tls *TLS) unsafe.Pointer

//sys: HANDLE GetProcessHeap();

func XGetSystemInfo

func XGetSystemInfo(tls *TLS, lpSystemInfo *XSYSTEM_INFO)

//sys: void GetSystemInfo(LPSYSTEM_INFO lpSystemInfo);

func XGetSystemTime

func XGetSystemTime(tls *TLS, lpSystemTime *XSYSTEMTIME)

//sys: void GetSystemTime(LPSYSTEMTIME lpSystemTime);

func XGetSystemTimeAsFileTime

func XGetSystemTimeAsFileTime(tls *TLS, lpSystemTimeAsFileTime *XFILETIME)

//sys: void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);

func XGetTempPathA

func XGetTempPathA(tls *TLS, nBufferLength uint32, lpBuffer *int8) uint32

//sys: DWORD GetTempPathA(DWORD nBufferLength, LPTSTR lpBuffer);

func XGetTempPathW

func XGetTempPathW(tls *TLS, nBufferLength uint32, lpBuffer *uint16) uint32

//sys: DWORD GetTempPathW(DWORD nBufferLength, LPCWSTR lpBuffer);

func XGetTickCount

func XGetTickCount(tls *TLS) uint32

//sys: DWORD GetTickCount();

func XGetVersionExA

func XGetVersionExA(tls *TLS, lpVersionInfo *XOSVERSIONINFOA) int32

//sys: BOOL GetVersionExA(LPOSVERSIONINFO lpVersionInfo);

func XGetVersionExW

func XGetVersionExW(tls *TLS, lpVersionInfo *XOSVERSIONINFOW) int32

//sys: BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInfo);

func XHeapAlloc

func XHeapAlloc(tls *TLS, hHeap unsafe.Pointer, dwFlags uint32, dwBytes uint64) unsafe.Pointer

//sys: LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes);

func XHeapCompact

func XHeapCompact(tls *TLS, hHeap unsafe.Pointer, dwFlags uint32) uint64

//sys: SIZE_T HeapCompact(HANDLE hHeap, DWORD dwFlags);

func XHeapCreate

func XHeapCreate(tls *TLS, flOptions uint32, dwInitialSize uint64, dwMaximumSize uint64) unsafe.Pointer

//sys: HANDLE HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize);

func XHeapDestroy

func XHeapDestroy(tls *TLS, hHeap unsafe.Pointer) int32

//sys: BOOL HeapDestroy(HANDLE hHeap);

func XHeapFree

func XHeapFree(tls *TLS, hHeap unsafe.Pointer, dwFlags uint32, lpMem unsafe.Pointer) int32

//sys: BOOL HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);

func XHeapReAlloc

func XHeapReAlloc(tls *TLS, hHeap unsafe.Pointer, dwFlags uint32, lpMem unsafe.Pointer, dwBytes uint64) unsafe.Pointer

//sys: LPVOID HeapReAlloc(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes);

func XHeapSize

func XHeapSize(tls *TLS, hHeap unsafe.Pointer, dwFlags uint32, lpMem unsafe.Pointer) uint64

//sys: SIZE_T HeapSize(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem);

func XHeapValidate

func XHeapValidate(tls *TLS, hHeap unsafe.Pointer, dwFlags uint32, lpMem unsafe.Pointer) int32

//sys: BOOL HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem);

func XInitializeCriticalSection

func XInitializeCriticalSection(tls *TLS, lpCriticalSection *XCRITICAL_SECTION)

//sys: void InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection);

func XLeaveCriticalSection

func XLeaveCriticalSection(tls *TLS, lpCriticalSection *XCRITICAL_SECTION)

//sys: void LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection);

func XLocalFree

func XLocalFree(tls *TLS, hMem unsafe.Pointer) unsafe.Pointer

//sys: HLOCAL LocalFree(HLOCAL hMem);

func XLockFile

func XLockFile(tls *TLS, hFile unsafe.Pointer, dwFileOffsetLow uint32, dwFileOffsetHigh uint32, nNumberOfBytesToLockLow uint32, nNumberOfBytesToLockHigh uint32) int32

//sys: BOOL LockFile(HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh);

func XLockFileEx

func XLockFileEx(tls *TLS, hFile unsafe.Pointer, dwFlags uint32, dwReserved uint32, nNumberOfBytesToLockLow uint32, nNumberOfBytesToLockHigh uint32, lpOverlapped *XOVERLAPPED) int32

//sys: BOOL LockFileEx(HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped);

func XMapViewOfFile

func XMapViewOfFile(tls *TLS, hFileMappingObject unsafe.Pointer, dwDesiredAccess uint32, dwFileOffsetHigh uint32, dwFileOffsetLow uint32, dwNumberOfBytesToMap uint64) unsafe.Pointer

//sys: LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap);

func XMultiByteToWideChar

func XMultiByteToWideChar(tls *TLS, CodePage uint32, dwFlags uint32, lpMultiByteStr *int8, cbMultiByte int32, lpWideCharStr *uint16, cchWideChar int32) int32

//sys: int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);

func XOutputDebugStringA

func XOutputDebugStringA(tls *TLS, lpOutputString *int8)

//sys: void OutputDebugStringA(LPCTSTR lpOutputString);

func XOutputDebugStringW

func XOutputDebugStringW(tls *TLS, lpOutputString *uint16)

//sys: void OutputDebugStringW(LPCWSTR lpOutputString);

func XQueryPerformanceCounter

func XQueryPerformanceCounter(tls *TLS, lpPerformanceCount *XLARGE_INTEGER) int32

//sys: BOOL QueryPerformanceCounter(LARGE_INTEGER* lpPerformanceCount);

func XReadFile

func XReadFile(tls *TLS, hFile unsafe.Pointer, lpBuffer unsafe.Pointer, nNumberOfBytesToRead uint32, lpNumberOfBytesRead *uint32, lpOverlapped *XOVERLAPPED) int32

//sys: BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);

func XSetEndOfFile

func XSetEndOfFile(tls *TLS, hFile unsafe.Pointer) int32

//sys: BOOL SetEndOfFile(HANDLE hFile);

func XSetFilePointer

func XSetFilePointer(tls *TLS, hFile unsafe.Pointer, lDistanceToMove int32, lpDistanceToMoveHigh *int32, dwMoveMethod uint32) uint32

//sys: DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);

func XSleep

func XSleep(tls *TLS, dwMilliseconds uint32)

//sys: void Sleep(DWORD dwMilliseconds);

func XSystemTimeToFileTime

func XSystemTimeToFileTime(tls *TLS, lpSystemTime *XSYSTEMTIME, lpFileTime *XFILETIME) int32

//sys: BOOL SystemTimeToFileTime(SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime);

func XUnlockFile

func XUnlockFile(tls *TLS, hFile unsafe.Pointer, dwFileOffsetLow uint32, dwFileOffsetHigh uint32, nNumberOfBytesToUnlockLow uint32, nNumberOfBytesToUnlockHigh uint32) int32

//sys: BOOL UnlockFile(HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh);

func XUnlockFileEx

func XUnlockFileEx(tls *TLS, hFile unsafe.Pointer, dwReserved uint32, nNumberOfBytesToUnlockLow uint32, nNumberOfBytesToUnlockHigh uint32, lpOverlapped *XOVERLAPPED) int32

//sys: BOOL UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped);

func XUnmapViewOfFile

func XUnmapViewOfFile(tls *TLS, lpBaseAddress unsafe.Pointer) int32

//sys: BOOL UnmapViewOfFile(LPCVOID lpBaseAddress);

func XWaitForSingleObject

func XWaitForSingleObject(tls *TLS, hHandle unsafe.Pointer, dwMilliseconds uint32) uint32

//sys: DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);

func XWaitForSingleObjectEx

func XWaitForSingleObjectEx(tls *TLS, hHandle unsafe.Pointer, dwMilliseconds uint32, bAlertable int32) uint32

//sys: DWORD WaitForSingleObjectEx(HANDLE hHandle, DWORD dwMilliseconds, BOOL bAlertable);

func XWideCharToMultiByte

func XWideCharToMultiByte(tls *TLS, CodePage uint32, dwFlags uint32, lpWideCharStr *uint16, cchWideChar int32, lpMultiByteStr *int8, cbMultiByte int32, lpDefaultChar *int8, lpUsedDefaultChar *int32) int32

//sys: int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);

func XWriteFile

func XWriteFile(tls *TLS, hFile unsafe.Pointer, lpBuffer unsafe.Pointer, nNumberOfBytesToWrite uint32, lpNumberOfBytesWritten *uint32, lpOverlapped *XOVERLAPPED) int32

//sys: BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);

func X_InterlockedCompareExchange

func X_InterlockedCompareExchange(tls *TLS, dest *int32, exchange, comparand int32) int32

LONG __cdecl InterlockedCompareExchange(_Inout_ LONG volatile *Destination,_In_ LONG Exchange,_In_ LONG Comparand); TODO: figure out if we can bypass a minor race (see below for an explanation)

func X__builtin_abort

func X__builtin_abort(tls *TLS)

void abort();

func X__builtin_abs

func X__builtin_abs(tks *TLS, j int32) int32

int abs(int j);

func X__builtin_assert_fail

func X__builtin_assert_fail(tls *TLS, file *int8, line int32, fn, msg *int8)

func X__builtin_bswap64

func X__builtin_bswap64(tls *TLS, x uint64) uint64

uint64_t __builtin_bswap64 (uint64_t x)

func X__builtin_copysign

func X__builtin_copysign(tls *TLS, x, y float64) float64

func X__builtin_exit

func X__builtin_exit(tls *TLS, n int32)

void exit(int);

func X__builtin_ffs

func X__builtin_ffs(tls *TLS, i int32) int32

int ffs(int i);

func X__builtin_ffsl

func X__builtin_ffsl(tls *TLS, i int64) int32

int ffsl(long i);

func X__builtin_ffsll

func X__builtin_ffsll(tls *TLS, i int64) int32

int ffsll(long long i);

func X__builtin_fprintf

func X__builtin_fprintf(tls *TLS, stream unsafe.Pointer, format *int8, args ...interface{}) int32

int __builtin_fprintf(void* stream, const char *format, ...);

func X__builtin_isprint

func X__builtin_isprint(tls *TLS, c int32) int32

int isprint(int c);

func X__builtin_malloc

func X__builtin_malloc(tls *TLS, size uint64) (p unsafe.Pointer)

void *malloc(size_t size);

func X__builtin_memcmp

func X__builtin_memcmp(tls *TLS, s1, s2 unsafe.Pointer, n uint64) int32

int memcmp(const void *s1, const void *s2, size_t n)

func X__builtin_memcpy

func X__builtin_memcpy(tls *TLS, dest, src unsafe.Pointer, n uint64) unsafe.Pointer

void *memcpy(void *dest, const void *src, size_t n)

func X__builtin_memset

func X__builtin_memset(tls *TLS, s unsafe.Pointer, c int32, n uint64) unsafe.Pointer

void *memset(void *s, int c, size_t n)

func X__builtin_printf

func X__builtin_printf(tls *TLS, format *int8, args ...interface{}) int32

int printf(const char *format, ...);

func X__builtin_sprintf

func X__builtin_sprintf(tls *TLS, str, format *int8, args ...interface{}) int32

int sprintf(char *str, const char *format, ...);

func X__builtin_strcmp

func X__builtin_strcmp(tls *TLS, s1, s2 *int8) int32

int strcmp(const char *s1, const char *s2)

func X__builtin_strcpy

func X__builtin_strcpy(tls *TLS, dest, src *int8) *int8

char *strcpy(char *dest, const char *src)

func X__builtin_strlen

func X__builtin_strlen(tls *TLS, s *int8) uint64

size_t strlen(const char *s)

func X__builtin_trap

func X__builtin_trap(tls *TLS)

void __builtin_trap();

func X__ctype_b_loc

func X__ctype_b_loc(tls *TLS) (r0 **uint16)

const unsigned short **__ctype_b_loc(void)

func X__errno_location

func X__errno_location(tls *TLS) *int32

extern int *__errno_location(void);

func X__register_stdfiles

func X__register_stdfiles(tls *TLS, in, out, err unsafe.Pointer)

void __register_stdfiles(void *, void *, void *);

func X__signbit

func X__signbit(tls *TLS, x float64) int32

int __signbit(double x);

func X__signbitf

func X__signbitf(tls *TLS, x float32) int32

int __signbitf(float x);

func X_beginthreadex

func X_beginthreadex(tls *TLS, a unsafe.Pointer, b uint32, c func(*TLS, unsafe.Pointer) uint32, d unsafe.Pointer, e uint32, f *uint32) uintptr

func X_endthreadex

func X_endthreadex(tls *TLS, a uint32)

func X_msize

func X_msize(tls *TLS, ptr unsafe.Pointer) uint32

func Xabort

func Xabort(tls *TLS)

void abort();

func Xabs

func Xabs(tls *TLS, j int32) int32

int abs(int j);

func Xacos

func Xacos(tls *TLS, x float64) float64

func Xasin

func Xasin(tls *TLS, x float64) float64

func Xatan

func Xatan(tls *TLS, x float64) float64

func Xatoi

func Xatoi(tls *TLS, _s *int8) (r0 int32)

int atoi(const char *nptr);

func Xcalloc

func Xcalloc(tls *TLS, nmemb, size uint64) (p unsafe.Pointer)

void *calloc(size_t nmemb, size_t size);

func Xceil

func Xceil(tls *TLS, x float64) float64

func Xclose

func Xclose(tls *TLS, fd int32) int32

int close(int fd);

func Xcopysign

func Xcopysign(tls *TLS, x, y float64) float64

func Xcos

func Xcos(tls *TLS, x float64) float64

func Xcosh

func Xcosh(tls *TLS, x float64) float64

func Xdlclose

func Xdlclose(tls *TLS, handle unsafe.Pointer) int32

int dlclose(void *handle);

func Xdlerror

func Xdlerror(tls *TLS) *int8

char *dlerror(void);

func Xdlopen

func Xdlopen(tls *TLS, filename *int8, flags int32) unsafe.Pointer

void *dlopen(const char *filename, int flags);

func Xdlsym

func Xdlsym(tls *TLS, handle unsafe.Pointer, symbol *int8) unsafe.Pointer

void *dlsym(void *handle, const char *symbol);

func Xexit

func Xexit(tls *TLS, n int32)

void exit(int);

func Xexp

func Xexp(tls *TLS, x float64) float64

func Xfabs

func Xfabs(tls *TLS, x float64) float64

func Xfclose

func Xfclose(tls *TLS, stream *unsafe.Pointer) int32

int fclose(FILE *stream);

func Xfflush

func Xfflush(tls *TLS, stream *unsafe.Pointer) int32

int fflush(FILE *stream);

func Xffs

func Xffs(tls *TLS, i int32) int32

int ffs(int i);

func Xffsl

func Xffsl(tls *TLS, i int64) int32

int ffsl(long i);

func Xffsll

func Xffsll(tls *TLS, i int64) int32

int ffsll(long long i);

func Xfgetc

func Xfgetc(tls *TLS, stream *unsafe.Pointer) int32

int fgetc(FILE *stream);

func Xfgets

func Xfgets(tls *TLS, s *int8, size int32, stream *unsafe.Pointer) *int8

char *fgets(char *s, int size, FILE *stream);

func Xfloor

func Xfloor(tls *TLS, x float64) float64

func Xfopen

func Xfopen(tls *TLS, path, mode *int8) *unsafe.Pointer

FILE *fopen(const char *path, const char *mode);

func Xfopen64

func Xfopen64(tls *TLS, path, mode *int8) *unsafe.Pointer

FILE *fopen64(const char *path, const char *mode);

func Xfprintf

func Xfprintf(tls *TLS, stream *unsafe.Pointer, format *int8, args ...interface{}) int32

int fprintf(FILE * stream, const char *format, ...);

func Xfread

func Xfread(tls *TLS, ptr unsafe.Pointer, size, nmemb uint64, stream *unsafe.Pointer) uint64

size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);

func Xfree

func Xfree(tls *TLS, ptr unsafe.Pointer)

void free(void *ptr);

func Xfseek

func Xfseek(tls *TLS, stream *unsafe.Pointer, offset, whence int32) int32

int fseek(FILE *stream, long offset, int whence);

func Xftell

func Xftell(tls *TLS, stream *unsafe.Pointer) int32

long ftell(FILE *stream);

func Xfwrite

func Xfwrite(tls *TLS, ptr unsafe.Pointer, size, nmemb uint64, stream *unsafe.Pointer) uint64

size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);

func Xgetenv

func Xgetenv(tls *TLS, name *int8) *int8

char *getenv(const char *name);

func Xindex

func Xindex(tls *TLS, s *int8, c int32) *int8

char *index(const char *s, int c)

func Xisprint

func Xisprint(tls *TLS, c int32) int32

int isprint(int c);

func Xlog

func Xlog(tls *TLS, x float64) float64

func Xlog10

func Xlog10(tls *TLS, x float64) float64

func Xmalloc

func Xmalloc(tls *TLS, size uint64) unsafe.Pointer

void *malloc(size_t size);

func Xmalloc_usable_size

func Xmalloc_usable_size(tls *TLS, ptr unsafe.Pointer) uint64

size_t malloc_usable_size (void *ptr);

func Xmemcmp

func Xmemcmp(tls *TLS, s1, s2 unsafe.Pointer, n uint64) int32

int memcmp(const void *s1, const void *s2, size_t n)

func Xmemcpy

func Xmemcpy(tls *TLS, dest, src unsafe.Pointer, n uint64) unsafe.Pointer

void *memcpy(void *dest, const void *src, size_t n)

func Xmemmove

func Xmemmove(tls *TLS, dest, src unsafe.Pointer, n uint64) unsafe.Pointer

void *memmove(void *dest, const void *src, size_t n);

func Xmempcpy

func Xmempcpy(tls *TLS, dest, src unsafe.Pointer, n uint64) unsafe.Pointer

void *mempcpy(void *dest, const void *src, size_t n);

func Xmemset

func Xmemset(tls *TLS, s unsafe.Pointer, c int32, n uint64) unsafe.Pointer

void *memset(void *s, int c, size_t n)

func Xopen

func Xopen(tls *TLS, pathname *int8, flags int32, args ...interface{}) int32

int open(const char *pathname, int flags, ...);

func Xopen64

func Xopen64(tls *TLS, pathname *int8, flags int32, args ...interface{}) int32

int open64(const char *pathname, int flags, ...);

func Xpow

func Xpow(tls *TLS, x, y float64) float64

func Xprintf

func Xprintf(tls *TLS, format *int8, args ...interface{}) int32

int printf(const char *format, ...);

func Xpthread_cond_signal

func Xpthread_cond_signal(tls *TLS, cond *Xpthread_cond_t) int32

int pthread_cond_signal(pthread_cond_t *cond);

func Xpthread_cond_wait

func Xpthread_cond_wait(tls *TLS, cond *Xpthread_cond_t, mutex *Xpthread_mutex_t) int32

int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);

func Xpthread_create

func Xpthread_create(tls *TLS, thread *uint64, attr *Xpthread_attr_t, start_routine func(*TLS, unsafe.Pointer) unsafe.Pointer, arg unsafe.Pointer) int32

int pthread_create(pthread_t *restrict thread, const pthread_attr_t *restrict attr, void *(*start_routine)(void*), void *restrict arg);

func Xpthread_detach

func Xpthread_detach(tls *TLS, thread uint64) int32

int pthread_detach(pthread_t thread);

func Xpthread_equal

func Xpthread_equal(tls *TLS, thread1, thread2 uint64) int32

extern int pthread_equal(pthread_t __thread1, pthread_t __thread2);

func Xpthread_join

func Xpthread_join(tls *TLS, thread uint64, value_ptr *unsafe.Pointer) int32

int pthread_join(pthread_t thread, void **value_ptr);

func Xpthread_mutex_destroy

func Xpthread_mutex_destroy(tls *TLS, mutex *Xpthread_mutex_t) int32

extern int pthread_mutex_destroy(pthread_mutex_t * __mutex);

func Xpthread_mutex_init

func Xpthread_mutex_init(tls *TLS, mutex *Xpthread_mutex_t, mutexattr *Xpthread_mutexattr_t) int32

extern int pthread_mutex_init(pthread_mutex_t * __mutex, pthread_mutexattr_t * __mutexattr);

func Xpthread_mutex_lock

func Xpthread_mutex_lock(tls *TLS, mutex *Xpthread_mutex_t) int32

extern int pthread_mutex_lock(pthread_mutex_t * __mutex);

func Xpthread_mutex_trylock

func Xpthread_mutex_trylock(tls *TLS, mutex *Xpthread_mutex_t) int32

int pthread_mutex_trylock(pthread_mutex_t *mutex);

func Xpthread_mutex_unlock

func Xpthread_mutex_unlock(tls *TLS, mutex *Xpthread_mutex_t) int32

extern int pthread_mutex_unlock(pthread_mutex_t * __mutex);

func Xpthread_mutexattr_destroy

func Xpthread_mutexattr_destroy(tls *TLS, attr *Xpthread_mutexattr_t) int32

extern int pthread_mutexattr_destroy(pthread_mutexattr_t * __attr);

func Xpthread_mutexattr_init

func Xpthread_mutexattr_init(tls *TLS, attr *Xpthread_mutexattr_t) int32

extern int pthread_mutexattr_init(pthread_mutexattr_t * __attr);

func Xpthread_mutexattr_settype

func Xpthread_mutexattr_settype(tls *TLS, attr *Xpthread_mutexattr_t, kind int32) int32

extern int pthread_mutexattr_settype(pthread_mutexattr_t * __attr, int __kind);

func Xpthread_self

func Xpthread_self(tls *TLS) uint64

pthread_t pthread_self(void);

func Xqsort

func Xqsort(tls *TLS, base unsafe.Pointer, nmemb, size uint64, compar func(tls *TLS, a, b unsafe.Pointer) int32)

void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));

func Xread

func Xread(tls *TLS, fd int32, buf unsafe.Pointer, count uint64) int64

ssize_t read(int fd, void *buf, size_t count);

func Xrealloc

func Xrealloc(tls *TLS, ptr unsafe.Pointer, size uint64) unsafe.Pointer

void *realloc(void *ptr, size_t size);

func Xrewind

func Xrewind(tls *TLS, stream *unsafe.Pointer)

void rewind(FILE *stream);

func Xrindex

func Xrindex(tls *TLS, s *int8, c int32) *int8

char *rindex(const char *s, int c)

func Xround

func Xround(tls *TLS, x float64) float64

double round(double x);

func Xsched_yield

func Xsched_yield(tls *TLS) int32

int sched_yield(void);

func Xsin

func Xsin(tls *TLS, x float64) float64

func Xsinh

func Xsinh(tls *TLS, x float64) float64

func Xsprintf

func Xsprintf(tls *TLS, str, format *int8, args ...interface{}) int32

int sprintf(char *str, const char *format, ...);

func Xsqrt

func Xsqrt(tls *TLS, x float64) float64

func Xstrcat

func Xstrcat(tls *TLS, dest, src *int8) *int8

char *strcat(char *dest, const char *src)

func Xstrchr

func Xstrchr(tls *TLS, s *int8, c int32) *int8

char *strchr(const char *s, int c)

func Xstrcmp

func Xstrcmp(tls *TLS, s1, s2 *int8) int32

int strcmp(const char *s1, const char *s2)

func Xstrcpy

func Xstrcpy(tls *TLS, dest, src *int8) *int8

char *strcpy(char *dest, const char *src)

func Xstrerror_r

func Xstrerror_r(tls *TLS, errnum int32, buf *int8, buflen uint64) int32

int strerror_r(int errnum, char *buf, size_t buflen);

func Xstrlen

func Xstrlen(tls *TLS, s *int8) uint64

size_t strlen(const char *s)

func Xstrncmp

func Xstrncmp(tls *TLS, s1, s2 *int8, n uint64) int32

int strncmp(const char *s1, const char *s2, size_t n)

func Xstrncpy

func Xstrncpy(tls *TLS, dest, src *int8, n uint64) *int8

char *strncpy(char *dest, const char *src, size_t n)

func Xstrrchr

func Xstrrchr(tls *TLS, s *int8, c int32) *int8

char *strrchr(const char *s, int c)

func Xtan

func Xtan(tls *TLS, x float64) float64

func Xtanh

func Xtanh(tls *TLS, x float64) float64

func Xtime

func Xtime(tls *TLS, tloc *int64) int64

time_t time(time_t *tloc);

func Xtolower

func Xtolower(tls *TLS, c int32) int32

int tolower(int c);

func Xvfprintf

func Xvfprintf(tls *TLS, stream *unsafe.Pointer, format *int8, ap []interface{}) int32

int vfprintf(FILE *stream, const char *format, va_list ap);

func Xvprintf

func Xvprintf(tls *TLS, format *int8, ap []interface{}) int32

int vprintf(const char *format, va_list ap);

Types

type TLS

type TLS struct {
	// contains filtered or unexported fields
}

TLS represents the C-thread local storage.

func NewTLS

func NewTLS() *TLS

NewTLS returns a newly created TLS.

func (*TLS) Close

func (t *TLS) Close()

TLS frees any resources used by t.

type XCRITICAL_SECTION

type XCRITICAL_SECTION struct {
	X0 unsafe.Pointer
	X1 int32
	X2 int32
	X3 unsafe.Pointer
	X4 unsafe.Pointer
	X5 uint64
}

type XFILETIME

type XFILETIME struct {
	X0 uint32
	X1 uint32
}

type XHMODULE

type XHMODULE struct {
	X0 int32
}

func XLoadLibraryA

func XLoadLibraryA(tls *TLS, lpFileName *int8) *XHMODULE

//sys: HMODULE LoadLibraryA(LPCTSTR lpFileName);

func XLoadLibraryW

func XLoadLibraryW(tls *TLS, lpFileName *uint16) *XHMODULE

//sys: HMODULE LoadLibraryW(LPCWSTR lpFileName);

type XLARGE_INTEGER

type XLARGE_INTEGER struct {
	X [0]struct {
		X0 struct {
			X0 uint32
			X1 int32
		}
		X1 struct {
			X0 uint32
			X1 int32
		}
		X2 int64
	}
	U [8]byte
}

type XOSVERSIONINFOA

type XOSVERSIONINFOA struct {
	X0 uint32
	X1 uint32
	X2 uint32
	X3 uint32
	X4 uint32
	X5 [128]int8
}

type XOSVERSIONINFOW

type XOSVERSIONINFOW struct {
	X0 uint32
	X1 uint32
	X2 uint32
	X3 uint32
	X4 uint32
	X5 [128]uint16
}

type XOVERLAPPED

type XOVERLAPPED struct {
	X0 uint64
	X1 uint64
	X2 struct {
		X [0]struct {
			X0 struct {
				X0 uint32
				X1 uint32
			}
			X1 unsafe.Pointer
		}
		U [8]byte
	}
	X3 unsafe.Pointer
}

type XSECURITY_ATTRIBUTES

type XSECURITY_ATTRIBUTES struct {
	X0 uint32
	X1 unsafe.Pointer
	X2 int32
}

type XSYSTEMTIME

type XSYSTEMTIME struct {
	X0 uint16
	X1 uint16
	X2 uint16
	X3 uint16
	X4 uint16
	X5 uint16
	X6 uint16
	X7 uint16
}

type XSYSTEM_INFO

type XSYSTEM_INFO struct {
	X0 struct {
		X [0]struct {
			X0 uint32
			X1 struct {
				X0 uint16
				X1 uint16
			}
		}
		U [4]byte
	}
	X1 uint32
	X2 unsafe.Pointer
	X3 unsafe.Pointer
	X4 uint64
	X5 uint32
	X6 uint32
	X7 uint32
	X8 uint16
	X9 uint16
}

type Xpthread_attr_t

type Xpthread_attr_t struct {
	X [0]struct {
		X0 [56]int8
		X1 int64
	}
	U [56]byte
}

type Xpthread_cond_t

type Xpthread_cond_t struct {
	X [0]struct {
		X__size  [48]int8
		X__align int64
		// contains filtered or unexported fields
	}
	U [48]byte

} // t4 union{__data struct{__lock int32,__futex uint32,__total_seq uint64,__wakeup_seq uint64,__woken_seq uint64,__mutex *struct{},__nwaiters uint32,__broadcast_seq uint32},__size [48]int8,__align int64}

type Xpthread_mutex_t

type Xpthread_mutex_t struct {
	X [0]struct {
		X0 struct {
			X0 int32
			X1 uint32
			X2 int32
			X3 uint32
			X4 int32
			X5 int16
			X6 int16
			X7 struct {
				X0 unsafe.Pointer
				X1 unsafe.Pointer
			}
		}
		X__size  [40]int8
		X__align int64
	}
	U [40]byte

} // union{__data struct{__lock int32,__count uint32,__owner int32,__nusers uint32,__kind int32,__spins int16,__elision int16,__list struct{__prev *struct{},__next *struct{}}},__size [40]int8,__align int64}

type Xpthread_mutexattr_t

type Xpthread_mutexattr_t struct {
	X [0]struct {
		X__size  [4]int8
		X__align int32
	}
	U [4]byte

} // t175 union{__size [4]int8,__align int32}

type Xtm

type Xtm struct {
	X0 int32
	X1 int32
	X2 int32
	X3 int32
	X4 int32
	X5 int32
	X6 int32
	X7 int32
	X8 int32
}

func Xlocaltime

func Xlocaltime(tls *TLS, timep *int64) *Xtm

struct tm *localtime(const time_t *timep);

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL