Browse Source

Windows fixes: DLL exports and cmake options

cl-refactor
Paweł Bylica 10 years ago
parent
commit
360b15e5f6
  1. 2
      CMakeLists.txt
  2. 2
      libevmjit/CMakeLists.txt
  3. 7
      libevmjit/Common.h
  4. 2
      libevmjit/ExecutionEngine.h
  5. 6
      libevmjit/Runtime.h
  6. 11
      libevmjit/interface.cpp

2
CMakeLists.txt

@ -4,7 +4,7 @@ project(evmjit)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
else() else()
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -fPIC") set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -fPIC")
endif() endif()

2
libevmjit/CMakeLists.txt

@ -20,5 +20,5 @@ target_link_libraries(${TARGET_NAME} PRIVATE ${LLVM_LIBS})
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION lib) install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
#install(FILES ${INTERFACE_HEADERS} DESTINATION include/${TARGET_NAME}) #install(FILES ${INTERFACE_HEADERS} DESTINATION include/${TARGET_NAME})

7
libevmjit/Common.h

@ -2,6 +2,13 @@
#include <vector> #include <vector>
#include <tuple> #include <tuple>
#include <cstdint>
#ifdef _MSC_VER
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
namespace dev namespace dev
{ {

2
libevmjit/ExecutionEngine.h

@ -16,7 +16,7 @@ public:
ExecutionEngine(ExecutionEngine const&) = delete; ExecutionEngine(ExecutionEngine const&) = delete;
void operator=(ExecutionEngine) = delete; void operator=(ExecutionEngine) = delete;
ReturnCode run(bytes const& _code, RuntimeData* _data, Env* _env); EXPORT ReturnCode run(bytes const& _code, RuntimeData* _data, Env* _env);
/// Reference to returned data (RETURN opcode used) /// Reference to returned data (RETURN opcode used)
bytes_ref returnData; bytes_ref returnData;

6
libevmjit/Runtime.h

@ -4,12 +4,6 @@
#include <csetjmp> #include <csetjmp>
#include "RuntimeData.h" #include "RuntimeData.h"
#ifdef _MSC_VER
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
namespace dev namespace dev
{ {
namespace eth namespace eth

11
libevmjit/interface.cpp

@ -5,17 +5,22 @@ extern "C"
using namespace dev::eth::jit; using namespace dev::eth::jit;
void* evmjit_create() noexcept #ifdef _MSC_VER
#define _ALLOW_KEYWORD_MACROS
#define noexcept throw()
#endif
EXPORT void* evmjit_create() noexcept
{ {
return new(std::nothrow) ExecutionEngine; return new(std::nothrow) ExecutionEngine;
} }
void evmjit_destroy(ExecutionEngine* _engine) noexcept EXPORT void evmjit_destroy(ExecutionEngine* _engine) noexcept
{ {
delete _engine; delete _engine;
} }
int evmjit_run(ExecutionEngine* _engine, RuntimeData* _data, Env* _env) noexcept EXPORT int evmjit_run(ExecutionEngine* _engine, RuntimeData* _data, Env* _env) noexcept
{ {
try try
{ {

Loading…
Cancel
Save