examples: Add header for example Precompiles VM

This commit is contained in:
Paweł Bylica 2019-11-05 12:33:35 +01:00
parent ef52f2954a
commit 206eb71c9e
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
3 changed files with 24 additions and 4 deletions

View File

@ -2,7 +2,7 @@
# Copyright 2019 The EVMC Authors. # Copyright 2019 The EVMC Authors.
# Licensed under the Apache License, Version 2.0. # Licensed under the Apache License, Version 2.0.
add_library(example-precompiles-vm SHARED example_precompiles_vm.cpp) add_library(example-precompiles-vm SHARED example_precompiles_vm.cpp example_precompiles_vm.h)
add_library(evmc::example-precompiles-vm ALIAS example-precompiles-vm) add_library(evmc::example-precompiles-vm ALIAS example-precompiles-vm)
target_link_libraries(example-precompiles-vm PRIVATE evmc) target_link_libraries(example-precompiles-vm PRIVATE evmc)

View File

@ -3,8 +3,7 @@
* Licensed under the Apache License, Version 2.0. * Licensed under the Apache License, Version 2.0.
*/ */
#include <evmc/evmc.h> #include "example_precompiles_vm.h"
#include <evmc/utils.h>
#include <algorithm> #include <algorithm>
static evmc_result execute_identity(const evmc_message* msg) static evmc_result execute_identity(const evmc_message* msg)
@ -112,7 +111,7 @@ static evmc_result execute(evmc_vm* /*unused*/,
} }
} }
extern "C" EVMC_EXPORT evmc_vm* evmc_create_example_precompiles_vm() evmc_vm* evmc_create_example_precompiles_vm()
{ {
static struct evmc_vm vm = { static struct evmc_vm vm = {
EVMC_ABI_VERSION, EVMC_ABI_VERSION,

View File

@ -0,0 +1,21 @@
/* EVMC: Ethereum Client-VM Connector API.
* Copyright 2019 The EVMC Authors.
* Licensed under the Apache License, Version 2.0.
*/
#pragma once
#include <evmc/evmc.h>
#include <evmc/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Creates EVMC Example Precompiles VM.
*/
EVMC_EXPORT struct evmc_vm* evmc_create_example_precompiles_vm(void);
#ifdef __cplusplus
}
#endif