Phasor 2.2.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
NativeRuntime_static_main.cpp
Go to the documentation of this file.
1
2
3#include <cstdint>
4#include <cstdio>
5#include <cstdlib>
6#include <iostream>
7#include <fstream>
8#include <filesystem>
9#include <string>
10#include <vector>
11
13
14// Forward declare native runtime entry points (linked in from the runtime library)
15extern "C" void exec(const unsigned char embeddedBytecode[], size_t embeddedBytecodeSize, const char *moduleName,
16 const void *nativeFunctionsVector, const int argc, const char *argv[]);
17
18// Main entry point
19int main(int argc, char *argv[], char *envp[])
20{
21 int exitCode = 1;
22
23 try
24 {
25 exec(embeddedBytecode, embeddedBytecodeSize, moduleName.c_str(), nullptr, argc, argv);
26 exitCode = 0;
27 }
28 catch (const std::exception &e)
29 {
30 std::cerr << "Runtime Error: " << e.what() << "\n";
31 return 1;
32 }
33
34 return exitCode;
35}
void exec(const unsigned char embeddedBytecode[], size_t embeddedBytecodeSize, const char *moduleName, const void *nativeFunctionsVector, const int argc, const char *argv[])
fn main()
The main execution loop of the Phasor Shell.
Definition Shell.dox:38