8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Fix MacOS UDR and Legacy_UserManager plugins not working due to not exported entry point. (#7088)

Add FB_DLL_EXPORT to public headers.

Use default visibility also for Linux/Unix (in addition to MacOS) as
user application can also be compiled with -fvisibility=hidden.
This commit is contained in:
Adriano dos Santos Fernandes 2021-12-27 10:30:34 -03:00
parent aa958bd206
commit efe42da059
22 changed files with 43 additions and 67 deletions

View File

@ -1318,7 +1318,7 @@ only for some specific OS you can make this place a bit simpler. In
minimum case the function should register module and all factories in
plugin manager:</font></p>
<p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt">extern
&quot;C&quot; void FB_DLL_EXPORT FB_PLUGIN_ENTRY_POINT(IMaster*
&quot;C&quot; FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(IMaster*
master)</font></p>
<p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt">{</font></p>
<p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt">IPluginManager*

View File

@ -281,7 +281,7 @@ Factory factory;
} // anonymous namespace
extern "C" void FB_DLL_EXPORT FB_PLUGIN_ENTRY_POINT(IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(IMaster* master)
{
IPluginManager* pluginManager = master->getPluginManager();

View File

@ -268,7 +268,7 @@ Factory factory;
} // anonymous namespace
extern "C" void FB_DLL_EXPORT FB_PLUGIN_ENTRY_POINT(IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(IMaster* master)
{
IPluginManager* pluginManager = master->getPluginManager();

View File

@ -38,14 +38,6 @@ typedef int FbSampleAtomic;
#include <ibase.h>
#include <firebird/Interface.h>
#if defined(_WIN32)
#define FB_DLL_EXPORT __declspec(dllexport)
#elif defined(__APPLE__)
#define FB_DLL_EXPORT __attribute__((visibility("default")))
#else
#define FB_DLL_EXPORT
#endif
using namespace Firebird;
#define SAMPLES_DIALECT SQL_DIALECT_V6

View File

@ -38,7 +38,7 @@
static Firebird::SimpleFactory<Auth::DebugClient> clientFactory;
static Firebird::SimpleFactory<Auth::DebugServer> serverFactory;
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
Firebird::CachedMasterInterface::set(master);

View File

@ -37,14 +37,6 @@
#include "../auth/SecureRemotePassword/Message.h"
#include "../common/classes/auto.h"
#ifndef FB_EXPORTED
#if defined(DARWIN)
#define FB_EXPORTED __attribute__((visibility("default")))
#else
#define FB_EXPORTED
#endif // OS choice (DARWIN)
#endif // FB_EXPORTED
namespace {
const unsigned int INIT_KEY = ((~0) - 1);
@ -987,7 +979,7 @@ static Firebird::SimpleFactory<Auth::SrpManagement> factory;
} // namespace Auth
extern "C" void FB_EXPORTED FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
Firebird::CachedMasterInterface::set(master);
Firebird::PluginManagerInterfacePtr()->registerPluginFactory(Firebird::IPluginManager::TYPE_AUTH_USER_MANAGEMENT, Auth::RemotePassword::plugName, &Auth::factory);

View File

@ -763,7 +763,7 @@ int SecurityDatabaseManagement::execute(Firebird::CheckStatusWrapper* st, Firebi
// register plugin
static Firebird::SimpleFactory<Auth::SecurityDatabaseManagement> factory;
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
Firebird::CachedMasterInterface::set(master);
Firebird::PluginManagerInterfacePtr()->registerPluginFactory(

View File

@ -423,7 +423,7 @@ void registerLegacyServer(IPluginManager* iPlugin)
#ifdef PLUG_MODULE
extern "C" void FB_EXPORTED FB_PLUGIN_ENTRY_POINT(IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(IMaster* master)
{
CachedMasterInterface::set(master);

View File

@ -244,8 +244,6 @@
#define API_ROUTINE __attribute__((visibility("default")))
#define API_ROUTINE_VARARG API_ROUTINE
#define INTERNAL_API_ROUTINE API_ROUTINE
#define FB_EXPORTED __attribute__((visibility("default")))
#define O_DIRECT F_NOCACHE
#endif /* Darwin Platforms */
@ -600,10 +598,6 @@ extern "C" int remove(const char* path);
#define CLIB_ROUTINE
#endif
#ifndef FB_EXPORTED
#define FB_EXPORTED
#endif
/* alignment macros */

View File

@ -21,19 +21,18 @@
#include <stdlib.h>
#include "ib_udf.h"
#include "firebird.h"
typedef void* VoidPtr;
#include "ibase.h"
// initialized by the engine
static void* (*allocFunc)(long) = NULL;
extern "C" void FB_EXPORTED ib_util_init(void* (*aAllocFunc)(long))
extern "C" FB_DLL_EXPORT void ib_util_init(void* (*aAllocFunc)(long))
{
allocFunc = aAllocFunc;
}
extern "C" VoidPtr FB_EXPORTED ib_util_malloc(long size)
extern "C" FB_DLL_EXPORT void* ib_util_malloc(long size)
{
return allocFunc ? allocFunc(size) : malloc(size);
}

View File

@ -43,13 +43,6 @@
#define DEBUG_GDS_ALLOC
#endif
#if defined(WIN_NT)
#define FB_DLL_EXPORT __declspec(dllexport)
#elif defined(DARWIN)
#define FB_DLL_EXPORT API_ROUTINE
#else
#define FB_DLL_EXPORT
#endif
//#if defined(SOLX86)
// this pragmas is used only with gcc 2.95!
//#define __PRAGMA_REDEFINE_EXTNAME

View File

@ -43,7 +43,7 @@
} \
} \
\
extern "C" FB_BOOLEAN* FB_UDR_PLUGIN_ENTRY_POINT(::Firebird::IStatus* status, \
extern "C" FB_DLL_EXPORT FB_BOOLEAN* FB_UDR_PLUGIN_ENTRY_POINT(::Firebird::IStatus* status, \
FB_BOOLEAN* theirUnloadFlag, ::Firebird::IUdrPlugin* udrPlugin) \
{ \
::Firebird::Udr::FactoryRegistration::finish(status, udrPlugin); \

View File

@ -468,7 +468,7 @@ struct
};
INTL_BOOL FB_DLL_EXPORT LD_lookup_charset(charset* cs, const ASCII* name, const ASCII* /*config_info*/)
FB_DLL_EXPORT INTL_BOOL LD_lookup_charset(charset* cs, const ASCII* name, const ASCII* /*config_info*/)
{
// ASF: We can't read config_info if version < INTL_VERSION_2,
// since it wasn't pushed in the stack by the engine.
@ -491,7 +491,7 @@ INTL_BOOL FB_DLL_EXPORT LD_lookup_charset(charset* cs, const ASCII* name, const
}
INTL_BOOL FB_DLL_EXPORT LD_lookup_texttype(texttype* tt, const ASCII* texttype_name, const ASCII* charset_name,
FB_DLL_EXPORT INTL_BOOL LD_lookup_texttype(texttype* tt, const ASCII* texttype_name, const ASCII* charset_name,
USHORT attributes, const UCHAR* specific_attributes,
ULONG specific_attributes_length, INTL_BOOL ignore_attributes,
const ASCII* config_info)
@ -557,7 +557,7 @@ INTL_BOOL FB_DLL_EXPORT LD_lookup_texttype(texttype* tt, const ASCII* texttype_n
}
ULONG FB_DLL_EXPORT LD_setup_attributes(
FB_DLL_EXPORT ULONG LD_setup_attributes(
const ASCII* textTypeName, const ASCII* charSetName, const ASCII* configInfo,
ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst)
{
@ -583,7 +583,7 @@ ULONG FB_DLL_EXPORT LD_setup_attributes(
}
void FB_DLL_EXPORT LD_version(USHORT* version)
FB_DLL_EXPORT void LD_version(USHORT* version)
{
// We support version 1 and 2.
if (*version != INTL_VERSION_1)

View File

@ -55,14 +55,6 @@
#define UINT16 USHORT
#if defined(WIN_NT)
#define FB_DLL_EXPORT __declspec(dllexport)
#elif defined(DARWIN)
#define FB_DLL_EXPORT API_ROUTINE
#else
#define FB_DLL_EXPORT
#endif
/* Following this line is LD.H from Borland Language Driver Kit */

View File

@ -38,13 +38,13 @@ struct CsConvertImpl
extern USHORT version;
INTL_BOOL FB_DLL_EXPORT LD_lookup_charset(charset* cs, const ASCII* name, const ASCII* config_info);
INTL_BOOL FB_DLL_EXPORT LD_lookup_texttype(texttype* tt, const ASCII* texttype_name, const ASCII* charset_name,
FB_DLL_EXPORT INTL_BOOL LD_lookup_charset(charset* cs, const ASCII* name, const ASCII* config_info);
FB_DLL_EXPORT INTL_BOOL LD_lookup_texttype(texttype* tt, const ASCII* texttype_name, const ASCII* charset_name,
USHORT attributes, const UCHAR* specific_attributes,
ULONG specific_attributes_length, INTL_BOOL ignore_attributes,
const ASCII* config_info);
void FB_DLL_EXPORT LD_version(USHORT* version);
ULONG FB_DLL_EXPORT LD_setup_attributes(
FB_DLL_EXPORT void LD_version(USHORT* version);
FB_DLL_EXPORT ULONG LD_setup_attributes(
const ASCII* textTypeName, const ASCII* charSetName, const ASCII* configInfo,
ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst);

View File

@ -64,6 +64,18 @@
#define FB_API_DEPRECATED
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
#define FB_DLL_EXPORT __declspec(dllexport)
#elif defined __has_attribute
#if __has_attribute (visibility)
#define FB_DLL_EXPORT __attribute__ ((visibility("default")))
#else
#define FB_DLL_EXPORT
#endif
#else
#define FB_DLL_EXPORT
#endif
#include "types_pub.h"
/********************************/

View File

@ -439,7 +439,7 @@ void registerEngine(IPluginManager* iPlugin)
} // namespace Jrd
extern "C" void FB_EXPORTED FB_PLUGIN_ENTRY_POINT(IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(IMaster* master)
{
CachedMasterInterface::set(master);
registerEngine(PluginManagerInterfacePtr());

View File

@ -762,7 +762,7 @@ class IExternalEngineFactoryImpl : public SimpleFactory<Engine>
{
} factory;
extern "C" void FB_EXPORTED FB_PLUGIN_ENTRY_POINT(IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(IMaster* master)
{
CachedMasterInterface::set(master);

View File

@ -700,7 +700,7 @@ void registerRedirector(Firebird::IPluginManager* iPlugin)
} // namespace Remote
/*
extern "C" void FB_PLUGIN_ENTRY_POINT(IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(IMaster* master)
{
IPluginManager* pi = master->getPluginManager();
registerRedirector(pi);
@ -1634,7 +1634,7 @@ void Attachment::freeClientData(CheckStatusWrapper* status, bool force)
// telling the user that an unrecoverable network error occurred and that
// if there was any uncommitted work, its gone...... Oh well....
ex.stuffException(status);
if (!fb_utils::isNetworkError(status->getErrors()[1]) && (!force))
{
return;
@ -3981,7 +3981,7 @@ Firebird::IEvents* Attachment::queEvents(CheckStatusWrapper* status, Firebird::I
port->connect(packet);
rem_port* port_async = port->port_async;
port_async->port_events_threadId =
port_async->port_events_threadId =
Thread::start(event_thread, port_async, THREAD_high, &port_async->port_events_thread);
port_async->port_context = rdb;

View File

@ -125,7 +125,7 @@ void registerTrace(Firebird::IPluginManager* iPlugin)
}
extern "C" void FB_EXPORTED FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
extern "C" FB_DLL_EXPORT void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
Firebird::CachedMasterInterface::set(master);
registerTrace(Firebird::PluginManagerInterfacePtr());

View File

@ -3731,13 +3731,13 @@ static void sanitize(Firebird::string& locale)
}
void FB_EXPORTED gds__default_printer(void* /*arg*/, SSHORT offset, const TEXT* line)
void API_ROUTINE_VARARG gds__default_printer(void* /*arg*/, SSHORT offset, const TEXT* line)
{
printf("%4d %s\n", offset, line);
}
void FB_EXPORTED gds__trace_printer(void* /*arg*/, SSHORT offset, const TEXT* line)
void API_ROUTINE_VARARG gds__trace_printer(void* /*arg*/, SSHORT offset, const TEXT* line)
{
// Assume that line is not too long
char buffer[PRETTY_BUFFER_SIZE + 10];

View File

@ -134,8 +134,10 @@ SINT64 API_ROUTINE isc_portable_integer(const UCHAR*, SSHORT);
void gds__cleanup();
void gds__ulstr(char* buffer, FB_UINT64 value, const int minlen, const char filler);
void FB_EXPORTED gds__default_printer(void*, SSHORT, const TEXT*);
void FB_EXPORTED gds__trace_printer(void*, SSHORT, const TEXT*);
// These functions uses cdecl convention in Windows, so use API_ROUTINE_VARARG instead of API_ROUTINE (stdcall).
void API_ROUTINE_VARARG gds__default_printer(void*, SSHORT, const TEXT*);
void API_ROUTINE_VARARG gds__trace_printer(void*, SSHORT, const TEXT*);
#ifdef NOT_USED_OR_REPLACED
void gds__print_pool(Firebird::MemoryPool*, const TEXT*, ...);
#endif