mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fixed fully qualified generic lookup
This commit is contained in:
parent
3b711932ec
commit
8aa58b3804
3 changed files with 67 additions and 14 deletions
|
@ -138,9 +138,7 @@ void TestMem()
|
||||||
char* mem = (char*)::VirtualAlloc(0, 4096 * 2, MEM_RESERVE, PAGE_READWRITE);
|
char* mem = (char*)::VirtualAlloc(0, 4096 * 2, MEM_RESERVE, PAGE_READWRITE);
|
||||||
::VirtualAlloc(mem, 4096, MEM_COMMIT, PAGE_READWRITE);
|
::VirtualAlloc(mem, 4096, MEM_COMMIT, PAGE_READWRITE);
|
||||||
|
|
||||||
char* str = "Hey";
|
|
||||||
char* cPtr = mem + 4096 - 3;
|
|
||||||
memcpy(cPtr, str, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test6()
|
void Test6()
|
||||||
|
@ -163,10 +161,41 @@ void Test3(int a)
|
||||||
Test4(100, 200, 300);
|
Test4(100, 200, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
class TestStruct
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int mA;
|
||||||
|
int mB;
|
||||||
|
int mC;
|
||||||
|
int mD;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EnumVal
|
||||||
|
{
|
||||||
|
EnumVal_A,
|
||||||
|
EnumVal_B,
|
||||||
|
EnumVal_C
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Color
|
||||||
|
{
|
||||||
|
float r, g, b, a;
|
||||||
|
};
|
||||||
|
|
||||||
// THIS IS VERSION 6.
|
// THIS IS VERSION 6.
|
||||||
extern "C"
|
extern "C"
|
||||||
__declspec(dllexport) void Test2(int aa, int bb, int cc, int dd)
|
__declspec(dllexport) void Test2(int aa, int bb, int cc, int dd, Color func(int a, int b))
|
||||||
{
|
{
|
||||||
|
Color clr = func(100, 200);
|
||||||
|
|
||||||
|
EnumVal ev = EnumVal_A;
|
||||||
|
|
||||||
|
TestStruct ts;
|
||||||
|
ts.mA = 123;
|
||||||
|
ts.mB = 234;
|
||||||
|
|
||||||
int a = 1234;
|
int a = 1234;
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
|
@ -174,9 +203,7 @@ __declspec(dllexport) void Test2(int aa, int bb, int cc, int dd)
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Test3(10);
|
Test3(10);
|
||||||
|
|
||||||
char* strP = "Hey yo";
|
|
||||||
|
|
||||||
TestMem();
|
TestMem();
|
||||||
|
|
||||||
|
|
|
@ -22,32 +22,32 @@
|
||||||
<ProjectGuid>{14700A80-0FC4-4A3D-99EF-8B78D4B070F1}</ProjectGuid>
|
<ProjectGuid>{14700A80-0FC4-4A3D-99EF-8B78D4B070F1}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>TestDLL</RootNamespace>
|
<RootNamespace>TestDLL</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>\Beef\BeefySysLib;\Beef\BeefySysLib\third_party</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>\Beef\BeefySysLib;\Beef\BeefySysLib\third_party;C:\temp\Chipmunk-7.0.3\include</AdditionalIncludeDirectories>
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
@ -112,7 +112,8 @@
|
||||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy C:\Beef\BeefTools\TestDLL\x64\Debug\TestDLL.dll c:\beef\ide\mintest\build\release_win64\mintest</Command>
|
<Command>
|
||||||
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
@ -152,6 +153,7 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="demo.c" />
|
||||||
<ClCompile Include="TestDLL.cpp" />
|
<ClCompile Include="TestDLL.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|
|
@ -21,6 +21,11 @@ namespace Hey.Dude.Bro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Color
|
||||||
|
{
|
||||||
|
public float r, g, b, a;
|
||||||
|
}
|
||||||
|
|
||||||
class TestClass
|
class TestClass
|
||||||
{
|
{
|
||||||
/*static void TestFunc()
|
/*static void TestFunc()
|
||||||
|
@ -37,8 +42,27 @@ namespace Hey.Dude.Bro
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
//private const uint16[] DebugIndexes = scope uint16[](0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Import(@"C:\Beef\BeefTools\TestDLL\x64\Debug\TestDLL.dll"), LinkName("Test2")]
|
||||||
|
public static extern void Test2(int32 a, int32 b, int32 c, int32 d, function Color(int32 a, int32 b) func);
|
||||||
|
|
||||||
|
public static Color GetColor(int32 a, int32 b)
|
||||||
|
{
|
||||||
|
Color c;
|
||||||
|
c.r = 1.2f;
|
||||||
|
c.g = 2.3f;
|
||||||
|
c.b = 3.4f;
|
||||||
|
c.a = 4.5f;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
public static int Main(String[] args)
|
public static int Main(String[] args)
|
||||||
{
|
{
|
||||||
|
Test2(1, 2, 3, 4, => GetColor);
|
||||||
|
|
||||||
//Blurg.Hey();
|
//Blurg.Hey();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue