Skip to content

Commit

Permalink
fix API and remove Windows-specific code
Browse files Browse the repository at this point in the history
  • Loading branch information
wlav committed Jul 15, 2021
1 parent e99d4a7 commit a7a2543
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,12 @@ class APICheck3Converter : public CPyCppyy::Converter {
*a3 = *(APICheck3*)CPyCppyy::Instance_AsVoidPtr(value);
return true;
}
#ifdef WIN32
virtual bool HasState() { return true; } // see register_a3 for reason
#endif
};
typedef CPyCppyy::ConverterFactory_t cf_t;
void register_a3() {
#ifndef WIN32
CPyCppyy::RegisterConverter("APICheck3", (cf_t)+[](CPyCppyy::dims_t) { static APICheck3Converter c{}; return &c; });
CPyCppyy::RegisterConverter("APICheck3&", (cf_t)+[](CPyCppyy::dims_t) { static APICheck3Converter c{}; return &c; });
#else
// Clang's JIT does not support relocation of the static variable on Windows
CPyCppyy::RegisterConverter("APICheck3", (cf_t)+[](CPyCppyy::dims_t) { return new APICheck3Converter{}; });
CPyCppyy::RegisterConverter("APICheck3&", (cf_t)+[](CPyCppyy::dims_t) { return new APICheck3Converter{}; });
#endif
}
void unregister_a3() {
CPyCppyy::UnregisterConverter("APICheck3");
Expand Down Expand Up @@ -174,19 +165,11 @@ class APICheck4Executor : public CPyCppyy::Executor {
a4->setExecutorCalled();
return CPyCppyy::Instance_FromVoidPtr(a4, "APICheck4", true);
}
#ifdef WIN32
virtual bool HasState() { return true; } // see register_a4 for reason
#endif
};
typedef CPyCppyy::ExecutorFactory_t ef_t;
void register_a4() {
#ifndef WIN32
CPyCppyy::RegisterExecutor("APICheck4*", (ef_t)+[]() { static APICheck4Executor c{}; return &c; });
#else
// Clang's JIT does not support relocation of the static variable on Windows
CPyCppyy::RegisterExecutor("APICheck4*", (ef_t)+[]() { return new APICheck4Executor{}; });
#endif
CPyCppyy::RegisterExecutor("APICheck4*", (ef_t)+[](CPyCppyy::dims_t) { static APICheck4Executor c{}; return &c; });
}
void unregister_a4() {
CPyCppyy::UnregisterExecutor("APICheck4*");
Expand Down

0 comments on commit a7a2543

Please sign in to comment.