Changeset f4399e in git


Ignore:
Timestamp:
Dec 14, 2012, 10:55:38 AM (11 years ago)
Author:
Alexander Dreyer <adreyer@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
1d6ec35f323c22dad6c849d92fd276b63460f494
Parents:
c1e7a64cbf29c8f08287152a94545e06e8608a9a
git-author:
Alexander Dreyer <adreyer@gmx.de>2012-12-14 10:55:38+01:00
git-committer:
Alexander Dreyer <adreyer@gmx.de>2012-12-14 15:08:38+01:00
Message:
fix: reloading of modules (multiply calling LIB("file.so")) is ignored
add: dynl_check_opened newly introduced
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/iplib.cc

    rc1e7a6 rf4399e  
    10791079    }
    10801080  }
     1081  if (dynl_check_opened(FullName)) {
     1082    if (BVERBOSE(V_LOAD_LIB)) Warn( "%s already loaded", fullname);
     1083    return FALSE;
     1084  }
    10811085  if((IDPACKAGE(pl)->handle=dynl_open(FullName))==(void *)NULL)
    10821086  {
     
    11251129
    11261130  pl = IDROOT->get(plib,0);
    1127   if (pl==NULL)
    1128   {
    1129     pl = enterid( plib,0, PACKAGE_CMD, &IDROOT,
    1130                   TRUE );
    1131     IDPACKAGE(pl)->language = LANG_C;
    1132     IDPACKAGE(pl)->libname=omStrDup(newlib);
    1133   }
     1131  if (pl!=NULL)
     1132  {
     1133    if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
     1134    omFree(plib);
     1135    return FALSE;
     1136  }
     1137
     1138  pl = enterid( plib,0, PACKAGE_CMD, &IDROOT,
     1139                TRUE );
     1140  IDPACKAGE(pl)->language = LANG_C;
     1141  IDPACKAGE(pl)->libname=omStrDup(newlib);
     1142
    11341143  IDPACKAGE(pl)->handle=(void *)NULL;
    11351144  SModulFunctions sModulFunctions;
  • libpolys/polys/mod_raw.cc

    rc1e7a6 rf4399e  
    55 * ABSTRACT: machine depend code for dynamic modules
    66 *
    7  * Provides: dynl_open()
     7 * Provides: dynl_check_opened()
     8 *           dynl_open()
    89 *           dynl_sym()
    910 *           dynl_error()
     
    241242
    242243static void* kernel_handle = NULL;
     244int dynl_check_opened(
     245  char *filename    /* I: filename to check */
     246  )
     247{
     248  return dlopen(filename,RTLD_NOW|RTLD_NOLOAD) != NULL;
     249}
     250
    243251void *dynl_open(
    244252  char *filename    /* I: filename to load */
     
    286294typedef char *((*func_ptr) ());
    287295
     296int dynl_check_opened(    /* NOTE: untested */
     297  char *filename    /* I: filename to check */
     298  )
     299{
     300  struct shl_descriptor *desc;
     301  for (int idx = 0; shl_get(idx, &desc) != -1; ++idx)
     302  {
     303    if (strcmp(filename, desc->filename) == 0) return TRUE;
     304  }
     305  return FALSE;
     306}
     307
    288308void *dynl_open(char *filename)
    289309{
     
    329349#ifndef DL_IMPLEMENTED
    330350
     351int dynl_check_opened(char *filename)
     352{
     353  return FALSE;
     354}
     355
    331356void *dynl_open(char *filename)
    332357{
  • libpolys/polys/mod_raw.h

    rc1e7a6 rf4399e  
     1
    12#ifndef MOD_RAW_H
    23#define MOD_RAW_H
     
    78 * ABSTRACT: machine depend code for dynamic modules
    89 *
    9  * Provides: dynl_open()
     10 * Provides: dynl_check_opened()
     11 *           dynl_open()
    1012 *           dynl_sym()
    1113 *           dynl_error()
     
    2628extern "C" {
    2729#endif
     30int          dynl_check_opened(char* filename);
    2831void *       dynl_open(char *filename);
    2932// if handle == DYNL_KERNEL_HANDLE, then symbol is searched for
     
    4750#endif
    4851
    49 /// Use @c add(name) to add built-in library to macro
     52/// Data for @c type_of_LIB to determine built-in modules,
     53/// use @c add(name) to add built-in library to macro
    5054#define SI_FOREACH_BUILTIN(add)\
    5155  add(huhu)\
Note: See TracChangeset for help on using the changeset viewer.