-
Notifications
You must be signed in to change notification settings - Fork 1
/
entry.cpp
37 lines (31 loc) · 910 Bytes
/
entry.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "workspace/includes.h"
auto start::main( ) -> int
{
CLVM vm( 1024 * 1024, 1024 );
lua_State* L = luaL_newstate( );
luaL_openlibs( L );
const std::string lua_code = R"( print("clvm in 2034 is real?!!!") )";
BytecodeEncoder encoder;
std::vector<unsigned char> bytecode;
try
{
bytecode = encoder.encode( lua_code );
std::string bytecode_str( bytecode.begin( ), bytecode.end( ) );
vm.load_bytecode( bytecode_str );
vm.execute( );
}
catch ( const std::exception& e )
{
std::cout << "Error: " << e.what( ) << std::endl;
}
return 0;
}
auto DllMain( [[maybe_unused]]HMODULE hmod, DWORD reason, [[maybe_unused]]LPVOID res ) -> bool APIENTRY
{
UNREFERENCED_PARAMETER( hmod );
UNREFERENCED_PARAMETER( res );
if ( reason == 1 )
{
start::main( );
}
}