mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-27 21:21:50 +03:00
25 lines
481 B
C++
25 lines
481 B
C++
#include "ExecSpace.h"
|
|
#include <cstdio>
|
|
|
|
typedef int (*MainFunctionPtr)(void);
|
|
|
|
int main(int, char**)
|
|
{
|
|
MappedFile f("_test.o");
|
|
if (!f.isValid()) {
|
|
fprintf(stderr, "Failed to map file :(\n");
|
|
return 1;
|
|
}
|
|
|
|
ExecSpace space;
|
|
space.loadELF(std::move(f));
|
|
|
|
auto func = reinterpret_cast<MainFunctionPtr>(space.symbolPtr("EntryPoint"));
|
|
printf("func: %p\n", func);
|
|
|
|
int z = func();
|
|
printf("func() returned %d\n", z);
|
|
|
|
return 0;
|
|
}
|