Mon May 11 14:05:00 CEST 2009 Tobias Rautenkranz * Visibility for C wrappers diff -rN -u old-smoke/src/smoke-c/CMakeLists.txt new-smoke/src/smoke-c/CMakeLists.txt --- old-smoke/src/smoke-c/CMakeLists.txt 2015-08-27 10:47:19.384232964 +0200 +++ new-smoke/src/smoke-c/CMakeLists.txt 2015-08-27 10:47:19.851200669 +0200 @@ -2,6 +2,12 @@ set(QT_DONT_USE_QTGUI true) include(${QT_USE_FILE}) +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag("-fvisibility=hidden" CXX_VISIBILITY) +if(CXX_VISIBILITY) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") +endif(CXX_VISIBILITY) + set(SMOKE_C_SOURCES smoke-c.cpp csmokebinding.cpp) add_library(smoke-c MODULE ${SMOKE_C_SOURCES}) diff -rN -u old-smoke/src/smoke-c/cl_smoke.h new-smoke/src/smoke-c/cl_smoke.h --- old-smoke/src/smoke-c/cl_smoke.h 2015-08-27 10:47:19.384232964 +0200 +++ new-smoke/src/smoke-c/cl_smoke.h 2015-08-27 10:47:19.740208345 +0200 @@ -1,5 +1,17 @@ +#ifndef CL_SMOKE_H +#define CL_SMOKE_H + #include +#if defined _WIN32 || defined __CYGWIN__ + #define CL_SMOKE_EXPORT __declspec(dllexport) +#else + #if __GNUC__ >= 4 + #define CL_SMOKE_EXPORT __attribute__((visibility("default"))) + #else + #define CL_SMOKE_EXPORT + #endif +#endif /** @brief Common Lisp smoke binding namespace. */ namespace cl_smoke @@ -33,3 +45,5 @@ return static_cast(smoke); } } // namespace cl_smoke + +#endif // CL_SMOKE_H diff -rN -u old-smoke/src/smoke-c/smoke-c-util.cpp new-smoke/src/smoke-c/smoke-c-util.cpp --- old-smoke/src/smoke-c/smoke-c-util.cpp 2015-08-27 10:47:19.383233033 +0200 +++ new-smoke/src/smoke-c/smoke-c-util.cpp 2015-08-27 10:47:19.515223905 +0200 @@ -1,3 +1,12 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define CL_SMOKE_EXPORT __declspec(dllexport) +#else + #if __GNUC__ >= 4 + #define CL_SMOKE_EXPORT __attribute__((visibility("default"))) + #else + #define CL_SMOKE_EXPORT + #endif +#endif /** @file * \@brief Utility functions @@ -9,7 +18,7 @@ * * @return the size of bool */ -int +CL_SMOKE_EXPORT int smoke_sizeof_bool() { return sizeof(bool); diff -rN -u old-smoke/src/smoke-c/smoke-c.cpp new-smoke/src/smoke-c/smoke-c.cpp --- old-smoke/src/smoke-c/smoke-c.cpp 2015-08-27 10:47:19.383233033 +0200 +++ new-smoke/src/smoke-c/smoke-c.cpp 2015-08-27 10:47:19.841201361 +0200 @@ -29,7 +29,7 @@ * * @return the Smoke module */ -void* +CL_SMOKE_EXPORT void* smoke_get_smoke(smoke_binding binding) { return get_smoke_binding(binding)->get_smoke(); @@ -44,7 +44,7 @@ * * @return a pointer to a new Smoke binding. */ -smoke_binding +CL_SMOKE_EXPORT smoke_binding smoke_init(void* smoke, void* destruct, void* dispatch) { return new Binding(static_cast(smoke), @@ -55,7 +55,7 @@ /** Deletes the smoke binding. * @related cl_smoke::Binding */ -void +CL_SMOKE_EXPORT void smoke_destruct(smoke_binding binding) { delete get_smoke_binding(binding)->get_smoke(); @@ -67,7 +67,7 @@ * * @return the module name */ -const char* +CL_SMOKE_EXPORT const char* smoke_get_module_name(void* smoke) { return get_smoke(smoke)->moduleName(); @@ -82,7 +82,7 @@ * @param smoke the smoke module * @param name the name of the class */ -void +CL_SMOKE_EXPORT void smoke_find_class(Smoke::ModuleIndex* c, void* smoke, const char* name) { *c = get_smoke(smoke)->findClass(name); @@ -94,7 +94,7 @@ * * @return the class ID in the supplied Smoke module */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_class_id(void* smoke, const char* name) { Smoke::ModuleIndex m = get_smoke(smoke)->idClass(name, true); @@ -109,7 +109,7 @@ * * @return the number of classes */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_classes_size(void* smoke) { return get_smoke(smoke)->numClasses; @@ -121,7 +121,7 @@ * @param class_index the index of the instances class * @param object pointer to the class instance. */ -void +CL_SMOKE_EXPORT void smoke_set_binding(void* smoke, smoke_binding binding, Smoke::Index class_index, void* object) { Q_ASSERT(object != NULL); @@ -142,7 +142,7 @@ * * @return A pointer to the class into the array of class structs */ -const struct Smoke::Class* +CL_SMOKE_EXPORT const struct Smoke::Class* smoke_get_class(void* smoke, Smoke::Index class_index) { Q_ASSERT(class_index >= 0 && class_index <= smoke_classes_size(smoke)); @@ -157,7 +157,7 @@ * * @return Returns 0 when the class is not derived from the base class and nonzero value otherwise. */ -int +CL_SMOKE_EXPORT int smoke_is_derived_from(void* smoke, Smoke::Index class_index, void* smoke_base, Smoke::Index base_index) { Q_ASSERT(!smoke_get_class(smoke, class_index)->external); @@ -173,7 +173,7 @@ * * @return the index of a parent */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_get_parent_index(void* smoke, Smoke::Index class_index) { Q_ASSERT(class_index >= 0); @@ -191,7 +191,7 @@ * * @return a pointer to the @c MethodMap entry. */ -const Smoke::MethodMap* +CL_SMOKE_EXPORT const Smoke::MethodMap* smoke_get_method_map(void* smoke, Smoke::Index method) { Q_ASSERT(method >= 0 && method <= get_smoke(smoke)->numMethodMaps); @@ -205,7 +205,7 @@ * * @return the method name */ -const char* +CL_SMOKE_EXPORT const char* smoke_get_method_name(void* smoke, Smoke::Index method_name) { Q_ASSERT(method_name >= 0 && method_name <= get_smoke(smoke)->numMethodNames); @@ -218,7 +218,7 @@ * * @return the number of method names */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_method_name_size(void *smoke) { return get_smoke(smoke)->numMethodNames; @@ -229,7 +229,7 @@ * * @return the number of methods */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_methods_size(void* smoke) { return get_smoke(smoke)->numMethods; @@ -241,7 +241,7 @@ * * @return a pointer to the method struct */ -const struct Smoke::Method* +CL_SMOKE_EXPORT const struct Smoke::Method* smoke_get_method(void* smoke, Smoke::Index method) { Q_ASSERT(method >= 0 && method <= smoke_methods_size(smoke)); @@ -255,7 +255,7 @@ * @param class_index index of the class * @param method_name method name */ -void +CL_SMOKE_EXPORT void smoke_find_method(Smoke::ModuleIndex* m, void* smoke, Smoke::Index class_index, const char* method_name) { @@ -271,7 +271,7 @@ * @param class_index index of the class * @param method_name index of the munged method name */ -void +CL_SMOKE_EXPORT void smoke_find_method_for_id(Smoke::ModuleIndex* m, void* smoke, Smoke::Index class_index, Smoke::Index method_name) { @@ -288,7 +288,7 @@ * * @return the type index */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_get_argument(void* smoke, Smoke::Index argument) { Q_ASSERT(argument >= 0); @@ -303,7 +303,7 @@ * @param object A pointer to the class instance, or NULL for static and constructor calls * @param stack The stack with the methods arguments. */ -void +CL_SMOKE_EXPORT void smoke_call_method(void* smoke, Smoke::Index method, void* object, Smoke::Stack stack) { @@ -344,7 +344,7 @@ * * @return the number of types */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_types_size(void* smoke) { return get_smoke(smoke)->numTypes; @@ -356,7 +356,7 @@ * * @return a pointer to the type struct */ -const struct Smoke::Type* +CL_SMOKE_EXPORT const struct Smoke::Type* smoke_get_type(void* smoke, Smoke::Index type) { Q_ASSERT(type >= 0 && type <= smoke_types_size(smoke)); @@ -370,7 +370,7 @@ * * @return the index of the type */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_find_type(void* smoke, const char* name) { return get_smoke(smoke)->idType(name); @@ -384,7 +384,7 @@ * * @return the casted object */ -void* +CL_SMOKE_EXPORT void* smoke_cast(void* smoke, void* object, Smoke::Index from, Smoke::Index to) { Q_ASSERT(from > 0 && from <= smoke_classes_size(smoke)); @@ -399,7 +399,7 @@ * * @return the index of a method */ -Smoke::Index +CL_SMOKE_EXPORT Smoke::Index smoke_ambiguous_method(void* smoke, Smoke::Index ambiguous) { Q_ASSERT(ambiguous >= 0);