help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Re: libglpk0: excessive install dependencies


From: Andrew Makhorin
Subject: [Help-glpk] Re: libglpk0: excessive install dependencies
Date: Thu, 20 Mar 2008 18:45:55 +0300

Xypron,

Just for your information: please see below shared library routines
I have added to glplib module.

To obtain an error message there is a new routine xerrmsg introduced
in 4.28 (it is also used by other glpk library routines).

Please inform me if the routines below are sufficient for our
purposes. (I have not implemented a Windows version yet, however, it
will be not so hard, I think.)

Best regards,

Andrew Makhorin

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

/* glplib12.c (shared library support) */

/* (reserved for copyright notice) */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "glplib.h"

/**********************************************************************/

#if defined(HAVE_LTDL_H)

/* GNU version */

#include "ltdl.h"

void *xdlopen(const char *module)
{     void *h = NULL;
      if (lt_dlinit() != 0)
      {  lib_err_msg(lt_dlerror());
         goto done;
      }
      h = lt_dlopen(module);
      if (h == NULL)
      {  lib_err_msg(lt_dlerror());
         if (lt_dlexit() != 0)
            xerror("xdlopen: lt_dlexit: %s\n", lt_dlerror());
      }
done: return h;
}

void *xdlsym(void *h, const char *symbol)
{     void *ptr;
      xassert(h != NULL);
      ptr = lt_dlsym(h, symbol);
      if (ptr == NULL)
         lib_err_msg(lt_dlerror());
      return ptr;
}

void xdlclose(void *h)
{     xassert(h != NULL);
      if (lt_dlclose(h) != 0)
         xerror("xdlclose: lt_dlclose: %s\n", lt_dlerror());
      if (lt_dlexit() != 0)
         xerror("xdlclose: lt_dlexit: %s\n", lt_dlerror());
      return;
}

/**********************************************************************/

#elif defined(HAVE_DLFCN_H)

/* POSIX version */

#include "dlfcn.h"

void *xdlopen(const char *module)
{     void *h = NULL;
      h = dlopen(module, 0);
      if (h == NULL)
         lib_err_msg(dlerror());
      return h;
}

void *xdlsym(void *h, const char *symbol)
{     void *ptr;
      xassert(h != NULL);
      ptr = dlsym(h, symbol);
      if (ptr == NULL)
         lib_err_msg(dlerror());
      return ptr;
}

void xdlclose(void *h)
{     xassert(h != NULL);
      if (dlclose(h) != 0)
         xerror("xdlclose: %s\n", dlerror());
      return;
}

/**********************************************************************/

#else

/* NULL version */

void *xdlopen(const char *module)
{     xassert(module == module);
      lib_err_msg("Shared libraries not supported");
      return NULL;
}

void *xdlsym(void *h, const char *symbol)
{     xassert(h != h);
      xassert(symbol != symbol);
      return NULL;
}

void xdlclose(void *h)
{     xassert(h != h);
      return;
}

#endif

/* eof */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]