Skip to content

Commit 974bf58

Browse files
authored
Merge pull request #3 from MichalStrehovsky/bit32
Compile as x86
2 parents 5764b6b + a5a97da commit 974bf58

File tree

14 files changed

+90
-30
lines changed

14 files changed

+90
-30
lines changed

src/BFlat.ZeroLib/Internal/Stubs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static unsafe void RhpAssignRef(void** dst, void* r)
161161
static unsafe MethodTable** AllocObject(uint size)
162162
{
163163
#if WINDOWS
164-
[DllImport("kernel32")]
164+
[DllImport("kernel32", EntryPoint = "_LocalAlloc@8")]
165165
static extern MethodTable** LocalAlloc(uint flags, uint size);
166166
MethodTable** result = LocalAlloc(0x40, size);
167167
#elif LINUX

src/BFlat.ZeroLib/System/Console.Windows.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private enum BOOL : int
2828
TRUE = 1,
2929
}
3030

31-
[DllImport("kernel32")]
31+
[DllImport("kernel32", EntryPoint = "_GetStdHandle@4")]
3232
private static unsafe extern IntPtr GetStdHandle(int c);
3333

3434
private readonly static IntPtr s_outputHandle = GetStdHandle(-11);
@@ -181,7 +181,7 @@ public static void SetCursorPosition(int x, int y)
181181
SetConsoleCursorPosition(s_outputHandle, new COORD { X = (short)x, Y = (short)y });
182182
}
183183

184-
[DllImport("kernel32", EntryPoint = "WriteConsoleW")]
184+
[DllImport("kernel32", EntryPoint = "_WriteConsoleW@20")]
185185
private static unsafe extern BOOL WriteConsole(IntPtr handle, void* buffer, int numChars, int* charsWritten, void* reserved);
186186

187187
public static unsafe void Write(char c)

src/BFlat.ZeroLib/System/Environment.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static partial class Environment
2727

2828
public static long TickCount64 => GetTickCount64();
2929

30-
[DllImport("kernel32")]
30+
[DllImport("kernel32", EntryPoint = "_RaiseFailFastException@12")]
3131
private static extern void RaiseFailFastException(IntPtr a, IntPtr b, int flags);
3232

3333
public static void FailFast(string message)

src/SmolSharp.HelloWorld/SmolSharp.HelloWorld.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

src/SmolSharp.Mandelbrot/SmolSharp.Mandelbrot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

src/SmolSharp.Ocean/SmolSharp.Ocean.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

src/SmolSharp.Win32/CompressAPI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace SmolSharp.Win32
55
{
66
internal static unsafe class CompressAPI
77
{
8-
[SuppressGCTransition, DllImport("Cabinet")]
8+
[SuppressGCTransition, DllImport("Cabinet", EntryPoint = "_CreateDecompressor@12")]
99
public static extern bool CreateDecompressor(
1010
CompressAlgorithm algorithm,
1111
nint allocationRoutines,
1212
nint* decompressorHandle
1313
);
1414

15-
[SuppressGCTransition, DllImport("Cabinet")]
15+
[SuppressGCTransition, DllImport("Cabinet", EntryPoint = "_Decompress@24")]
1616
public static extern bool Decompress(
1717
nint decompressorHandle,
1818
void* compressedData,

src/SmolSharp.Win32/GDI/Gdi32.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ namespace SmolSharp.Win32.GDI
66
{
77
internal static unsafe class Gdi32
88
{
9-
[SuppressGCTransition, DllImport("gdi32")]
9+
[SuppressGCTransition, DllImport("gdi32", EntryPoint = "_SetPixel@16")]
1010
public static extern uint SetPixel(
1111
nint hdc,
1212
int x, int y,
1313
uint color
1414
);
1515

16-
[SuppressGCTransition, DllImport("gdi32")]
16+
[SuppressGCTransition, DllImport("gdi32", EntryPoint = "_ChoosePixelFormat@8")]
1717
public static extern int ChoosePixelFormat(
1818
nint hdc,
1919
PixelFormatDescriptor* ppfd
2020
);
2121

22-
[SuppressGCTransition, DllImport("gdi32")]
22+
[SuppressGCTransition, DllImport("gdi32", EntryPoint = "_SetPixelFormat@12")]
2323
public static extern bool SetPixelFormat(
2424
nint hdc,
2525
int format,
2626
PixelFormatDescriptor* ppfd
2727
);
2828

29-
[SuppressGCTransition, DllImport("gdi32")]
29+
[SuppressGCTransition, DllImport("gdi32", EntryPoint = "_SwapBuffers@4")]
3030
public static extern bool SwapBuffers(
3131
nint hdc
3232
);

src/SmolSharp.Win32/GDI/OpenGL/GL.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ internal static class GL
1515
public const uint TRIANGLES = 0x4;
1616

1717
[SuppressGCTransition]
18-
[DllImport("opengl32", EntryPoint = "wglCreateContext")]
18+
[DllImport("opengl32", EntryPoint = "_wglCreateContext@4")]
1919
public static extern nint CreateContext(nint hdc);
2020

2121
[SuppressGCTransition]
22-
[DllImport("opengl32", EntryPoint = "wglMakeCurrent")]
22+
[DllImport("opengl32", EntryPoint = "_wglMakeCurrent@8")]
2323
public static extern bool MakeCurrent(nint hdc, nint ctx);
2424

2525
[SuppressGCTransition]
@@ -31,19 +31,19 @@ internal static class GL
3131
public static extern void Clear(uint mask);
3232

3333
[SuppressGCTransition]
34-
[DllImport("opengl32", EntryPoint = "wglGetProcAddress")]
34+
[DllImport("opengl32", EntryPoint = "_wglGetProcAddress@4")]
3535
public static unsafe extern void* GetProcAddress(byte* name);
3636

3737
[SuppressGCTransition]
38-
[DllImport("opengl32", EntryPoint = "glDrawArrays")]
38+
[DllImport("opengl32", EntryPoint = "_glDrawArrays@12")]
3939
public static extern void DrawArrays(
4040
uint mode,
4141
int first,
4242
int count
4343
);
4444

4545
[SuppressGCTransition]
46-
[DllImport("opengl32", EntryPoint = "glViewport")]
46+
[DllImport("opengl32", EntryPoint = "_glViewport@16")]
4747
public static extern void Viewport(int x, int y, uint width, uint height);
4848

4949
[SuppressGCTransition]

src/SmolSharp.Win32/Kernel32.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace SmolSharp.Win32
55
{
66
internal static unsafe class Kernel32
77
{
8-
[SuppressGCTransition, DllImport("kernel32")]
8+
[SuppressGCTransition, DllImport("kernel32", EntryPoint = "_CreateThread@24")]
99
public static extern nint CreateThread(
1010
nint threadAttributes,
1111
nint stackSize,
@@ -15,13 +15,13 @@ public static extern nint CreateThread(
1515
nint lpThreadId = 0
1616
);
1717

18-
[SuppressGCTransition, DllImport("kernel32")]
18+
[SuppressGCTransition, DllImport("kernel32", EntryPoint = "_GlobalAlloc@8")]
1919
public static extern void* GlobalAlloc(uint dwFlags, nint dwBytes);
2020

21-
[SuppressGCTransition, DllImport("kernel32")]
21+
[SuppressGCTransition, DllImport("kernel32", EntryPoint = "_AllocConsole@0")]
2222
public static extern bool AllocConsole();
2323

24-
[SuppressGCTransition, DllImport("kernel32")]
24+
[SuppressGCTransition, DllImport("kernel32", EntryPoint = "_Sleep@4")]
2525
public static extern void Sleep(uint ms);
2626
}
2727
}

0 commit comments

Comments
 (0)