feat: use PIC code model for shared libraries, fix shared library bugs

This commit is contained in:
2026-04-08 17:07:55 +02:00
parent d87c14da25
commit 28d0614511
10 changed files with 85 additions and 25 deletions
+20 -1
View File
@@ -100,7 +100,26 @@ extern "C" void _start() {
// Debug: print hello_run address
montauk::print(" DEBUG: hello_run @ ");
print_hex((uint64_t)hello_run);
montauk::print("\n");
montauk::print("\n\n");
// Test heap allocations in the shared library
montauk::print("Testing heap allocations in libhello...\n");
typedef int (*malloc_test_t)(void);
malloc_test_t malloc_test = (malloc_test_t)libloader::dlsym(hellolib, "hello_malloc_test");
if (!malloc_test) {
montauk::print("ERROR: Failed to resolve hello_malloc_test\n");
libloader::dlclose(hellolib);
montauk::exit(1);
}
montauk::print(" hello_malloc_test: OK\n");
int malloc_result = malloc_test();
if (malloc_result != 0) {
montauk::print("ERROR: heap allocation test in libhello failed\n");
libloader::dlclose(hellolib);
montauk::exit(1);
}
montauk::print(" heap allocation test: PASSED\n\n");
// Run the GUI demo (this creates a window and event loop)
montauk::print("Running GUI demo...\n");