Create header for example_host

This commit is contained in:
Paweł Bylica 2018-08-30 17:38:14 +02:00
parent 43dce45a5b
commit 78888b57a9
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
3 changed files with 26 additions and 9 deletions

View File

@ -5,7 +5,8 @@
/// @file
/// Example implementation of an EVMC Host.
#include <evmc/evmc.h>
#include "example_host.h"
#include <evmc/helpers.h>
static evmc_uint256be balance(evmc_context* context, const evmc_address* address)
@ -138,6 +139,8 @@ struct example_host_context : evmc_context
example_host_context() : evmc_context{&methods} {}
};
extern "C" {
evmc_context* example_host_create_context()
{
return new example_host_context;
@ -146,4 +149,5 @@ evmc_context* example_host_create_context()
void example_host_destroy_context(evmc_context* context)
{
delete context;
}
}
}

View File

@ -0,0 +1,18 @@
/* EVMC: Ethereum Client-VM Connector API.
* Copyright 2018 The EVMC Authors.
* Licensed under the Apache License, Version 2.0. See the LICENSE file.
*/
#include <evmc/evmc.h>
#if __cplusplus
extern "C" {
#endif
struct evmc_context* example_host_create_context();
void example_host_destroy_context(struct evmc_context* context);
#if __cplusplus
}
#endif

View File

@ -1,7 +1,8 @@
// EVMC -- Ethereum Client-VM Connector API
// EVMC: Ethereum Client-VM Connector API
// Copyright 2018 The EVMC Authors.
// Licensed under the Apache License, Version 2.0. See the LICENSE file.
#include "../../examples/example_host/example_host.h"
#include "vmtester.hpp"
#include <evmc/helpers.h>
@ -9,12 +10,6 @@
#include <array>
#include <cstring>
// Declarations of functions from example host:
evmc_context* example_host_create_context();
void example_host_destroy_context(evmc_context* context);
// Compile time checks:
static_assert(sizeof(evmc_uint256be) == 32, "evmc_uint256be is too big");