examples: Fix example_vm

- Make it compatible with C++
- Properly return project version
This commit is contained in:
Paweł Bylica 2019-01-22 13:08:02 +01:00
parent 86e2e2685d
commit 709965077f
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/* EVMC: Ethereum Client-VM Connector API.
* Copyright 2018 The EVMC Authors.
* Licensed under the Apache License, Version 2.0. See the LICENSE file.
* Copyright 2019 The EVMC Authors.
* Licensed under the Apache License, Version 2.0.
*/
/// @file
@ -158,6 +158,7 @@ static void set_tracer(struct evmc_instance* instance,
/// Stringify the argument.
#define STR(x) #x
#define XSTR(x) STR(x)
#if !defined(PROJECT_VERSION)
/// The dummy project version if not provided by the build system.
@ -171,7 +172,7 @@ struct evmc_instance* evmc_create_example_vm()
struct evmc_instance init = {
.abi_version = EVMC_ABI_VERSION,
.name = "example_vm",
.version = STR(PROJECT_VERSION),
.version = XSTR(PROJECT_VERSION),
.destroy = destroy,
.execute = execute,
.get_capabilities = get_capabilities,

View File

@ -8,7 +8,15 @@
#include <evmc/evmc.h>
#include <evmc/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Creates EVMC Example VM.
*/
EVMC_EXPORT struct evmc_instance* evmc_create_example_vm(void);
#ifdef __cplusplus
}
#endif