common: Move dynamic libary loading definitions into common header.

master
Solomon Peachy 3 years ago
parent d0d6ef32b4
commit d4b8ec0bc3
  1. 23
      backend_common.h
  2. 21
      backend_mitsu70x.c
  3. 23
      backend_mitsu9550.c
  4. 21
      backend_shinkos6145.c

@ -351,4 +351,27 @@ extern struct dyesub_backend BACKEND;
quiet++; \
break;
/* Dynamic library loading */
#if defined(USE_DLOPEN)
#define WITH_DYNAMIC
#include <dlfcn.h>
#define DL_INIT() do {} while(0)
#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
#define DL_SYM(__x, __y) dlsym(__x, __y)
#define DL_CLOSE(__x) dlclose(__x)
#define DL_EXIT() do {} while(0)
#elif defined(USE_LTDL)
#define WITH_DYNAMIC
#include <ltdl.h>
#define DL_INIT() lt_dlinit()
#define DL_OPEN(__x) lt_dlopen(__x)
#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() lt_dlexit()
#else
#define DL_INIT() do {} while(0)
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() do {} while(0)
#endif
#endif /* __BACKEND_COMMON_H */

@ -33,26 +33,7 @@
#include <config.h>
#endif
#if defined(USE_DLOPEN)
#define WITH_DYNAMIC
#include <dlfcn.h>
#define DL_INIT() do {} while(0)
#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
#define DL_SYM(__x, __y) dlsym(__x, __y)
#define DL_CLOSE(__x) dlclose(__x)
#define DL_EXIT() do {} while(0)
#elif defined(USE_LTDL)
#define WITH_DYNAMIC
#include <ltdl.h>
#define DL_INIT() lt_dlinit()
#define DL_OPEN(__x) lt_dlopen(__x)
#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() lt_dlexit()
#else
#define DL_INIT() do {} while(0)
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() do {} while(0)
#ifndef WITH_DYNAMIC
#warning "No dynamic loading support!"
#endif

@ -1,7 +1,7 @@
/*
* Mitsubishi CP-9xxx Photo Printer Family CUPS backend
*
* (c) 2014-2019 Solomon Peachy <pizza@shaftnet.org>
* (c) 2014-2020 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@ -33,26 +33,7 @@
#include <config.h>
#endif
#if defined(USE_DLOPEN)
#define WITH_DYNAMIC
#include <dlfcn.h>
#define DL_INIT() do {} while(0)
#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
#define DL_SYM(__x, __y) dlsym(__x, __y)
#define DL_CLOSE(__x) dlclose(__x)
#define DL_EXIT() do {} while(0)
#elif defined(USE_LTDL)
#define WITH_DYNAMIC
#include <ltdl.h>
#define DL_INIT() lt_dlinit()
#define DL_OPEN(__x) lt_dlopen(__x)
#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() lt_dlexit()
#else
#define DL_INIT() do {} while(0)
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() do {} while(0)
#ifndef WITH_DYNAMIC
#warning "No dynamic loading support!"
#endif

@ -47,26 +47,7 @@
#include <config.h>
#endif
#if defined(USE_DLOPEN)
#define WITH_DYNAMIC
#include <dlfcn.h>
#define DL_INIT() do {} while(0)
#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
#define DL_SYM(__x, __y) dlsym(__x, __y)
#define DL_CLOSE(__x) dlclose(__x)
#define DL_EXIT() do {} while(0)
#elif defined(USE_LTDL)
#define WITH_DYNAMIC
#include <ltdl.h>
#define DL_INIT() lt_dlinit()
#define DL_OPEN(__x) lt_dlopen(__x)
#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() lt_dlexit()
#else
#define DL_INIT() do {} while(0)
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() do {} while(0)
#ifndef WITH_DYNAMIC
#warning "No dynamic loading support!"
#endif

Loading…
Cancel
Save