From 5372417ca67452cba2dff78bfb34d39797f226f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 25 Jun 2018 18:39:34 +0200 Subject: [PATCH] Properly export symbols from DLLs --- examples/examplevm/examplevm.h | 3 ++- include/evmc/instructions.h | 5 +++-- include/evmc/utils.h | 12 ++++++++++++ lib/instructions/CMakeLists.txt | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 include/evmc/utils.h diff --git a/examples/examplevm/examplevm.h b/examples/examplevm/examplevm.h index f1ebf98..37261ef 100644 --- a/examples/examplevm/examplevm.h +++ b/examples/examplevm/examplevm.h @@ -6,8 +6,9 @@ #pragma once #include +#include /** * Creates EVMC Example VM. */ -struct evmc_instance* evmc_create_examplevm(void); +EVMC_EXPORT struct evmc_instance* evmc_create_examplevm(void); diff --git a/include/evmc/instructions.h b/include/evmc/instructions.h index 4492427..1dc50b9 100644 --- a/include/evmc/instructions.h +++ b/include/evmc/instructions.h @@ -6,6 +6,7 @@ #pragma once #include +#include #include @@ -191,7 +192,7 @@ struct evmc_instruction_metrics * @return The pointer to the array of 256 instruction metrics. Null pointer in case * an invalid EVM revision provided. */ -const struct evmc_instruction_metrics* evmc_get_instruction_metrics_table( +EVMC_EXPORT const struct evmc_instruction_metrics* evmc_get_instruction_metrics_table( enum evmc_revision revision); /** @@ -203,7 +204,7 @@ const struct evmc_instruction_metrics* evmc_get_instruction_metrics_table( * @return The pointer to the array of 256 instruction names. Null pointer in case * an invalid EVM revision provided. */ -const char* const* evmc_get_instruction_names_table(enum evmc_revision revision); +EVMC_EXPORT const char* const* evmc_get_instruction_names_table(enum evmc_revision revision); #if __cplusplus } diff --git a/include/evmc/utils.h b/include/evmc/utils.h new file mode 100644 index 0000000..c527c61 --- /dev/null +++ b/include/evmc/utils.h @@ -0,0 +1,12 @@ +/* EVMC: Ethereum Client-VM Connector API. + * Copyright 2018 Pawel Bylica. + * Licensed under the MIT License. See the LICENSE file. + */ + +#pragma once + +#ifdef _MSC_VER +#define EVMC_EXPORT __declspec(dllexport) +#else +#define EVMC_EXPORT __attribute__ ((visibility ("default"))) +#endif diff --git a/lib/instructions/CMakeLists.txt b/lib/instructions/CMakeLists.txt index 10cbca1..a9b0d3e 100644 --- a/lib/instructions/CMakeLists.txt +++ b/lib/instructions/CMakeLists.txt @@ -3,7 +3,7 @@ # Licensed under the MIT License. See the LICENSE file. add_library( - instructions + instructions STATIC ${include_dir}/evmc/instructions.h instruction_metrics.c instruction_names.c