update to 0.7.0

This commit is contained in:
Razor12911
2023-04-29 22:51:51 +02:00
parent 552a733296
commit 50c7c248da
144 changed files with 42115 additions and 22130 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,248 @@
unit BorlndMM;
interface
{--------------------Start of options block-------------------------}
{Set the following option to use the RTL MM instead of FastMM. Setting this
option makes this replacement DLL almost identical to the default
borlndmm.dll, unless the "FullDebugMode" option is also set.}
{.$define UseRTLMM}
{--------------------End of options block-------------------------}
{$Include FastMM4Options.inc}
{Cannot use the RTL MM with full debug mode}
{$ifdef FullDebugMode}
{$undef UseRTLMM}
{$endif}
function GetAllocMemCount: integer;
function GetAllocMemSize: integer;
procedure DumpBlocks;
function HeapRelease: Integer;
function HeapAddRef: Integer;
function SysReallocMem(P: Pointer; Size: Integer): Pointer;
function SysFreeMem(P: Pointer): Integer;
function SysGetMem(Size: Integer): Pointer;
function SysAllocMem(Size: Cardinal): Pointer;
function ReallocMemory(P: Pointer; Size: Integer): Pointer; cdecl;
function FreeMemory(P: Pointer): Integer; cdecl;
function GetMemory(Size: Integer): Pointer; cdecl;
function GetHeapStatus: THeapStatus; deprecated; platform;
function RegisterExpectedMemoryLeak(ALeakedPointer: Pointer): Boolean;
function UnregisterExpectedMemoryLeak(ALeakedPointer: Pointer): Boolean;
implementation
{$ifndef UseRTLMM}
uses
FastMM4;
{$endif}
{$OPTIMIZATION ON}
{$STACKFRAMES OFF}
{$RANGECHECKS OFF}
{$OVERFLOWCHECKS OFF}
{$ifdef NoDebugInfo}
{$DEBUGINFO OFF}
{$endif}
//Export: GetAllocMemCount
//Symbol: @Borlndmm@GetAllocMemCount$qqrv
function GetAllocMemCount: integer;
begin
{Return stats for the RTL MM only}
{$ifdef UseRTLMM}
Result := System.AllocMemCount;
{$else}
Result := 0;
{$endif}
end;
//Export: GetAllocMemSize
//Symbol: @Borlndmm@GetAllocMemSize$qqrv
function GetAllocMemSize: integer;
begin
{Return stats for the RTL MM only}
{$ifdef UseRTLMM}
Result := System.AllocMemSize;
{$else}
Result := 0;
{$endif}
end;
//Export: DumpBlocks
//Symbol: @Borlndmm@DumpBlocks$qqrv
procedure DumpBlocks;
begin
{Do nothing}
end;
//Export: @Borlndmm@HeapRelease$qqrv
//Symbol: @Borlndmm@HeapRelease$qqrv
function HeapRelease: Integer;
begin
{Do nothing}
Result := 2;
end;
//Export: @Borlndmm@HeapAddRef$qqrv
//Symbol: @Borlndmm@HeapAddRef$qqrv
function HeapAddRef: Integer;
begin
{Do nothing}
Result := 2;
end;
//Export: GetHeapStatus
//Symbol: @Borlndmm@GetHeapStatus$qqrv
function GetHeapStatus: THeapStatus; deprecated; platform;
begin
{$ifndef UseRTLMM}
Result := FastGetHeapStatus;
{$else}
Result := System.GetHeapStatus;
{$endif}
end;
//Export: ReallocMemory
//Symbol: @Borlndmm@ReallocMemory$qpvi
function ReallocMemory(P: Pointer; Size: Integer): Pointer; cdecl;
begin
Result := System.ReallocMemory(P, Size);
end;
//Export: FreeMemory
//Symbol: @Borlndmm@FreeMemory$qpv
function FreeMemory(P: Pointer): Integer; cdecl;
begin
Result := System.FreeMemory(P);
end;
//Export: GetMemory
//Symbol: @Borlndmm@GetMemory$qi
function GetMemory(Size: Integer): Pointer; cdecl;
begin
Result := System.GetMemory(Size);
end;
//Export: @Borlndmm@SysReallocMem$qqrpvi
//Symbol: @Borlndmm@SysReallocMem$qqrpvi
function SysReallocMem(P: Pointer; Size: Integer): Pointer;
begin
{$ifndef UseRTLMM}
{$ifndef FullDebugMode}
Result := FastReallocMem(P, Size);
{$else}
Result := DebugReallocMem(P, Size);
{$endif}
{$else}
Result := System.SysReallocMem(P, Size);
{$endif}
end;
//Export: @Borlndmm@SysFreeMem$qqrpv
//Symbol: @Borlndmm@SysFreeMem$qqrpv
function SysFreeMem(P: Pointer): Integer;
begin
{$ifndef UseRTLMM}
{$ifndef FullDebugMode}
Result := FastFreeMem(P);
{$else}
Result := DebugFreeMem(P);
{$endif}
{$else}
Result := System.SysFreeMem(P);
{$endif}
end;
//Export: @Borlndmm@SysGetMem$qqri
//Symbol: @Borlndmm@SysGetMem$qqri
function SysGetMem(Size: Integer): Pointer;
begin
{$ifndef UseRTLMM}
{$ifndef FullDebugMode}
Result := FastGetMem(Size);
{$else}
Result := DebugGetMem(Size);
{$endif}
{$else}
Result := System.SysGetMem(Size);
{$endif}
end;
//Export: @Borlndmm@SysAllocMem$qqri
//Symbol: @Borlndmm@SysAllocMem$qqrui
function SysAllocMem(Size: Cardinal): Pointer;
begin
{$ifndef UseRTLMM}
{$ifndef FullDebugMode}
Result := FastAllocMem(Size);
{$else}
Result := DebugAllocMem(Size);
{$endif}
{$else}
//{$ifdef VER180}
{$if RTLVersion >= 18}
Result := System.SysAllocMem(Size);
{$ifend}
{$if RTLVersion < 18}
Result := System.AllocMem(Size);
{$ifend}
{$endif}
end;
//Export: @Borlndmm@SysUnregisterExpectedMemoryLeak$qqrpi
//Symbol: @Borlndmm@UnregisterExpectedMemoryLeak$qqrpv
function UnregisterExpectedMemoryLeak(ALeakedPointer: Pointer): Boolean;
begin
{$ifndef UseRTLMM}
{$ifdef EnableMemoryLeakReporting}
Result := UnregisterExpectedMemoryLeak(ALeakedPointer);
{$else}
Result := False;
{$endif}
{$else}
//{$ifdef VER180}
{$if RTLVersion >= 18}
Result := System.SysUnregisterExpectedMemoryLeak(ALeakedPointer);
{$ifend}
{$if RTLVersion < 18}
Result := False;
{$ifend}
{$endif}
end;
//Export: @Borlndmm@SysRegisterExpectedMemoryLeak$qqrpi
//Symbol: @Borlndmm@RegisterExpectedMemoryLeak$qqrpv
function RegisterExpectedMemoryLeak(ALeakedPointer: Pointer): Boolean;
begin
{$ifndef UseRTLMM}
{$ifdef EnableMemoryLeakReporting}
Result := RegisterExpectedMemoryLeak(ALeakedPointer);
{$else}
Result := False;
{$endif}
{$else}
//{$ifdef VER180}
{$if RTLVersion >= 18}
Result := System.SysRegisterExpectedMemoryLeak(ALeakedPointer);
{$ifend}
{$if RTLVersion < 18}
Result := False;
{$ifend}
{$endif}
end;
initialization
IsMultiThread := True;
finalization
end.

View File

@@ -0,0 +1,30 @@
//---------------------------------------------------------------------------
#include <windows.h>
//---------------------------------------------------------------------------
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------

View File

@@ -0,0 +1,29 @@
LIBRARY BORLNDMM.DLL
EXPORTS
GetAllocMemCount = @Borlndmm@GetAllocMemCount$qqrv ;To make it the 2nd export, ___CPPdebugHook always the 1st export
GetAllocMemSize = @Borlndmm@GetAllocMemSize$qqrv
GetHeapStatus = @Borlndmm@GetHeapStatus$qqrv
DumpBlocks = @Borlndmm@DumpBlocks$qqrv
ReallocMemory = @Borlndmm@ReallocMemory$qpvi
FreeMemory = @Borlndmm@FreeMemory$qpv
GetMemory = @Borlndmm@GetMemory$qi
@Borlndmm@SysUnregisterExpectedMemoryLeak$qqrpi = @Borlndmm@UnregisterExpectedMemoryLeak$qqrpv
@Borlndmm@SysRegisterExpectedMemoryLeak$qqrpi = @Borlndmm@RegisterExpectedMemoryLeak$qqrpv
@Borlndmm@SysAllocMem$qqri = @Borlndmm@SysAllocMem$qqrui
@Borlndmm@SysReallocMem$qqrpvi
@Borlndmm@SysFreeMem$qqrpv
@Borlndmm@SysGetMem$qqri
@Borlndmm@HeapRelease$qqrv
@Borlndmm@HeapAddRef$qqrv
SetMMLogFileName = @Fastmm4@SetMMLogFileName$qqrpc
GetCurrentAllocationGroup = @Fastmm4@GetCurrentAllocationGroup$qqrv
PushAllocationGroup = @Fastmm4@PushAllocationGroup$qqrui
PopAllocationGroup = @Fastmm4@PopAllocationGroup$qqrv
LogAllocatedBlocksToFile = @Fastmm4@LogAllocatedBlocksToFile$qqruiui

View File

@@ -0,0 +1 @@
LoadDebugDLLDynamically must be defined.