Changeset 7e5a38 in git for Singular/mod_raw.cc


Ignore:
Timestamp:
Dec 7, 2000, 4:04:03 PM (24 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd25190065115c859833252500a64cfb7b11e3a50')
Children:
8f79d773fb56da78b5f8ed5221984b47fb7404a5
Parents:
3c13f654591de9411714b65349412f92daf673a4
Message:
* dynamic loading of p_Procs


git-svn-id: file:///usr/local/Singular/svn/trunk@4833 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/mod_raw.cc

    r3c13f6 r7e5a38  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mod_raw.cc,v 1.8 2000-05-23 13:10:10 Singular Exp $ */
     4/* $Id: mod_raw.cc,v 1.9 2000-12-07 15:03:57 obachman Exp $ */
    55/*
    66 * ABSTRACT: machine depend code for dynamic modules
     
    1515#include "static.h"
    1616#ifdef HAVE_STATIC
    17 #undef HAVE_DYNAMIC_LOADING
    18 #undef HAVE_DYN_RL
     17#undef HAVE_DL
    1918#endif
    2019
    21 #if defined(HAVE_DYNAMIC_LOADING) || defined(HAVE_DYN_RL)
     20#if defined(HAVE_DL)
    2221#include "mod_raw.h"
     22#include "febase.h"
     23
     24/*****************************************************************************
     25 *
     26 * General section
     27 * These are just wrappers around the repsective dynl_* calls
     28 * which look for the binary in the bin_dir of Singular and ommit warnings if
     29 * somethings goes wrong
     30 *
     31 *****************************************************************************/
     32static BOOLEAN warn_handle = FALSE;
     33static BOOLEAN warn_proc = FALSE;
     34#ifndef DL_TAIL
     35#define DL_TAIL "so"
     36#endif
     37
     38void* dynl_open_binary_warn(char* binary_name)
     39{
     40  void* handle = NULL;
     41  const char* bin_dir = feGetResource('b');
     42  if (bin_dir != NULL)
     43  {
     44    char path_name[MAXPATHLEN];
     45    sprintf(path_name, "%s%s%s.%s", bin_dir, DIR_SEPP, binary_name,
     46            DL_TAIL);
     47    handle = dynl_open(path_name);
     48    if (handle == NULL && ! warn_handle)
     49    {
     50      Warn("Could not open dynamic library: %s", path_name);
     51      Warn("Error message from system: %s", dynl_error());
     52      Warn("Singular will work properly, but much slower.");
     53      Warn("See the INSTALL section in the Singular manual for details.");
     54      warn_handle = TRUE;
     55    }
     56  }
     57  return  handle;
     58}
     59
     60void* dynl_sym_warn(void* handle, char* proc)
     61{
     62  void *proc_ptr = NULL;
     63  if (handle != NULL)
     64  {
     65    proc_ptr = dynl_sym(handle, proc);
     66    if (proc_ptr == NULL && ! warn_proc)
     67    {
     68      Warn("Could load a procedure from a dynamic library");
     69      Warn("Error message from system: %s", dynl_error());
     70      Warn("Singular will work properly, but much slower.");
     71      Warn("See the INSTALL section in the Singular manual for details.");
     72      warn_proc = TRUE;
     73    }
     74  }
     75  return proc_ptr;
     76}
    2377
    2478
     
    299353
    300354
    301 #endif /* HAVE_DYNAMIC_LOADING */
     355#endif /* HAVE_DL */
Note: See TracChangeset for help on using the changeset viewer.