'basic.sbp #ifndef _INC_BASIC #define _INC_BASIC Sub _System_InitDllGlobalVariables() 'dummy End Sub Const LONG_MAX = &H7FFFFFFF Const LONG_MIN = &H80000000 Const FLT_MAX = 3.402823466e+38 Const FLT_MIN = 1.175494351e-38 '------------- ' Basic Types '------------- 'Char 'Byte 'Integer 'Word 'Long TypeDef Int32 = Long 'DWord 'Int64 'QWord 'Single 'Double TypeDef Int16 = Integer TypeDef Int8 = SByte TypeDef BOOL = Long ' Boolena型の定数 Const True = 1 As Boolean Const False = 0 As Boolean '------------------ ' Types of pointer '------------------ TypeDef BytePtr = *Byte TypeDef WordPtr = *Word TypeDef DWordPtr = *DWord TypeDef SinglePtr = *Single TypeDef DoublePtr = *Double #ifdef _WIN64 TypeDef LONG_PTR = Int64 TypeDef ULONG_PTR = QWord TypeDef HALF_PTR = Long TypeDef UHALF_PTR = DWord #else TypeDef LONG_PTR = Long TypeDef ULONG_PTR = DWord TypeDef HALF_PTR = Integer TypeDef UHALF_PTR = Word #endif TypeDef DWORD_PTR = ULONG_PTR Sub SetPointer(pPtr As VoidPtr, p As VoidPtr) Set_LONG_PTR(pPtr, p As LONG_PTR) End Sub Function GetPointer(pPtr As VoidPtr) As VoidPtr GetPointer = Get_LONG_PTR(pPtr) As VoidPtr End Function Sub Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR) #ifdef _WIN64 SetQWord(pPtr,lpData) #else SetDWord(pPtr,lpData) #endif End Sub Function Get_LONG_PTR(pPtr As VoidPtr) As LONG_PTR #ifdef _WIN64 Get_LONG_PTR = GetQWord(pPtr) #else Get_LONG_PTR = GetDWord(pPtr) #endif End Function Sub SetChar(p As *Char, c As Char) p[0] = c End Sub Function GetChar(p As *Char) As Char GetChar = p[0] End Function TypeDef SIZE_T = ULONG_PTR TypeDef SSIZE_T = LONG_PTR TypeDef WCHAR = Word '-------------------------- ' Specify elements number '-------------------------- Const ELM(n) = (n - 1) #include #include #include Sub _System_GetEip() 'dummy End Sub Dim _System_CriticalSection As CRITICAL_SECTION Dim _System_hProcessHeap As HANDLE Sub _System_StartupProgram() 'Unsafe 'この関数はアプリケーションの起動時にシステムからコールバックされます InitializeCriticalSection(_System_CriticalSection) _System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0) ' GC管理オブジェクトを生成 _System_pGC = _System_calloc( SizeOf( _System_CGarbageCollection ) ) _System_pGC->Begin() 'Initialize global variables _System_InitDllGlobalVariables() 'Initialize static variables _System_InitStaticLocalVariables() 'TODO: ' Set current thread priority 'Dim thread = Thread.CurrentThread() 'thread.Priority = ThreadPriority.Normal 'End Unsafe End Sub Sub _System_EndProgram() 'Unsafe _System_Call_Destructor_of_GlobalObject() ' GC管理オブジェクトを破棄 _System_pGC->Finish() _System_free( _System_pGC ) DeleteCriticalSection(_System_CriticalSection) HeapDestroy( _System_hProcessHeap ) 'End Unsafe End Sub #include #include #include #include #include #include #include #include #endif '_INC_BASIC