mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Added ability to retrieve module name for Beef DLL projects
This commit is contained in:
parent
5fce0af004
commit
84f03abcc7
4 changed files with 31 additions and 1 deletions
|
@ -48,6 +48,14 @@ namespace System
|
|||
});
|
||||
}
|
||||
|
||||
public static void GetModuleFilePath(String outPath)
|
||||
{
|
||||
Platform.GetStrHelper(outPath, scope (outPtr, outSize, outResult) =>
|
||||
{
|
||||
Platform.BfpDynLib_GetFilePath((.)Internal.[Friend]sModuleHandle, outPtr, outSize, (Platform.BfpLibResult*)outResult);
|
||||
});
|
||||
}
|
||||
|
||||
public static uint32 TickCount
|
||||
{
|
||||
get
|
||||
|
|
|
@ -70,6 +70,13 @@ namespace System
|
|||
static extern int32 Test_Query();
|
||||
static extern void Test_Finish();
|
||||
|
||||
static void* sModuleHandle;
|
||||
[AlwaysInclude]
|
||||
static void SetModuleHandle(void* handle)
|
||||
{
|
||||
sModuleHandle = handle;
|
||||
}
|
||||
|
||||
public static Object ObjectAlloc(TypeInstance typeInst, int size)
|
||||
{
|
||||
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
||||
|
|
|
@ -70,6 +70,13 @@ namespace System
|
|||
static extern int32 Test_Query();
|
||||
static extern void Test_Finish();
|
||||
|
||||
static void* sModuleHandle;
|
||||
[AlwaysInclude]
|
||||
static void SetModuleHandle(void* handle)
|
||||
{
|
||||
sModuleHandle = handle;
|
||||
}
|
||||
|
||||
public static Object ObjectAlloc(TypeInstance typeInst, int size)
|
||||
{
|
||||
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
||||
|
|
|
@ -1644,6 +1644,14 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
|||
bfModule->mBfIRBuilder->CreateCondBr(cmpResult, initBlock, initSkipBlock);
|
||||
bfModule->mBfIRBuilder->AddBlock(initBlock);
|
||||
bfModule->mBfIRBuilder->SetInsertPoint(initBlock);
|
||||
|
||||
auto moduleMethodInstance = bfModule->GetInternalMethod("SetModuleHandle", 1);
|
||||
if (moduleMethodInstance)
|
||||
{
|
||||
SmallVector<BfIRValue, 1> args;
|
||||
args.push_back(bfModule->mBfIRBuilder->GetArgument(0));
|
||||
bfModule->mBfIRBuilder->CreateCall(moduleMethodInstance.mFunc, args);
|
||||
}
|
||||
}
|
||||
|
||||
// Do the LoadLibrary calls below priority 100
|
||||
|
@ -1841,7 +1849,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
|||
|
||||
BfIRBlock deinitSkipBlock;
|
||||
if (project->mTargetType == BfTargetType_BeefDynLib)
|
||||
{
|
||||
{
|
||||
auto deinitBlock = bfModule->mBfIRBuilder->CreateBlock("doDeinit", false);
|
||||
deinitSkipBlock = bfModule->mBfIRBuilder->CreateBlock("skipDeinit", false);
|
||||
auto cmpResult = bfModule->mBfIRBuilder->CreateCmpEQ(bfModule->mBfIRBuilder->GetArgument(1), bfModule->mBfIRBuilder->CreateConst(BfTypeCode_Int32, 0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue