aboutsummaryrefslogtreecommitdiffstats
path: root/include/afb/c++/binding-wrap.hpp
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2019-01-04 15:49:18 +0100
committerLoïc Collignon <loic.collignon@iot.bzh>2019-01-04 16:54:53 +0100
commit8506a0dc4974703982732da57f06d96e335195d2 (patch)
treefe124588d48cd9782e6543c6180d75daeae1be32 /include/afb/c++/binding-wrap.hpp
parent2bb052bea267b0ddee8571cc8606087e81229ddb (diff)
Fix multiple definition and cast
The function was defined as many time as the header was included. Making it a weak function fix the issue. Also, a plain old C cast is required to make this constexpr valid. Change-Id: Iee5677873180accfddcad0b3a58f3776f9fd8c5e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'include/afb/c++/binding-wrap.hpp')
-rw-r--r--include/afb/c++/binding-wrap.hpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/include/afb/c++/binding-wrap.hpp b/include/afb/c++/binding-wrap.hpp
index edca0701..c65c4c7f 100644
--- a/include/afb/c++/binding-wrap.hpp
+++ b/include/afb/c++/binding-wrap.hpp
@@ -571,8 +571,7 @@ constexpr afb_verb_t verb(
return r;
}
-#if AFB_BINDING_VERSION >= 3
-void __afb__verb__cb__for__global__(afb_req_t r)
+void __attribute__((weak)) __afb__verb__cb__for__global__(afb_req_t r)
{
void *vcbdata;
void (*callback)(req);
@@ -587,8 +586,7 @@ constexpr afb_verb_t verb(
void (&callback)(req),
const char *info = nullptr,
uint16_t session = 0,
- const afb_auth *auth = nullptr
- ,
+ const afb_auth *auth = nullptr,
bool glob = false,
void *vcbdata = nullptr
)
@@ -600,10 +598,9 @@ constexpr afb_verb_t verb(
session,
auth,
glob,
- reinterpret_cast<void*>(&callback)
+ (void*)(&callback)
);
}
-#endif
constexpr afb_verb_t verbend()
{