Changeset b22a1e2 in tol


Ignore:
Timestamp:
Dec 22, 2015, 12:36:23 PM (11 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
89cc521
Parents:
d5e4e94
Message:

refs #1904, fixes #1905, DynLoad + incremento de versión

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@7139 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tol/CMakeLists.txt

    rd5e4e94 rb22a1e2  
    238238if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
    239239  add_definitions( -DUNIX )
     240  #set( CMAKE_SHARED_LINKER_FLAGS "-rdynamic ${CMAKE_SHARED_LINKER_FLAGS}" )
    240241endif( )
    241242
  • tol/LoadDynLib/LoadDynLib.cpp

    rd5e4e94 rb22a1e2  
    3434#include <tol/tol_btxtgra.h>
    3535#include <tol/tol_bdatgra.h>
     36#include <tol/tol_bsetgra.h>
    3637#include <tol/tol_bdir.h>
    3738
    … …  
    123124  }
    124125}
     126
     127//--------------------------------------------------------------------
     128DeclareContensClass(BDat, BDatTemporary, BDatDynLoad);
     129DefExtOpr(1, BDatDynLoad, "DynLoad", 1, 2, "Text Set",
     130          "(Text libraryPath [, Set options])",
     131          I2("Load a dynamic library without TOL built-in functions.",
     132             "Carga una librería dinámica sin funciones TOL nativas."),
     133          BOperClassify::Statistic_);
     134void BDatDynLoad::CalcContens()
     135//--------------------------------------------------------------------
     136{
     137  if(CheckNonDeclarativeAction("LoadDynLib")) { return; }
     138  BText& libraryPath = Text(Arg(1));
     139  lt_dladvise advise;
     140  if( Arg( 2 ) )
     141    {
     142    BSet& options = Set( Arg( 2 ) );
     143    bool hasAdvise = false;
     144    bool global = false;
     145    BSyntaxObject *obj = options["global"];
     146    if ( obj && obj->Grammar() == GraReal( ) )
     147      {
     148      BDat &dGlobal = Dat( obj );
     149      global = dGlobal.Value() != 0;
     150      hasAdvise = true;
     151      }
     152    else
     153      {
     154      Warning( "DynLoad: global option provided but with wrong type, must be Real" );
     155      }
     156    if ( hasAdvise )
     157      {
     158      if ( !lt_dladvise_init( &advise ) )
     159        {
     160        if ( global )
     161          {
     162          lt_dladvise_global( &advise );
     163          }
     164        }
     165      else
     166        {
     167        advise = NULL;
     168        Warning( "DynLoad: not using advise, lt_dladvise_init failed" );
     169        }
     170      }
     171    else
     172      {
     173      advise = NULL;
     174      }
     175    }
     176  else
     177    {
     178    advise = NULL;
     179    }
     180//Std(BText("\nTRACE BLoadDynLib::Evaluator 1 libraryPath=")+libraryPath);
     181//Std(BText("\nTRACE BLoadDynLib::Evaluator 2 libraryName=")+libraryName);
     182  BUserNameBlock* unb ATTR_UNUSED = NULL;
     183
     184  // se cambia el directorio de trabajo (cwd) inicial
     185  BText currentDir = BDir::GetCurrent();
     186  BDir::ChangeCurrent(GetFilePath(libraryPath));
     187
     188  lt_dlhandle handleLib;
     189
     190  // abro la DynLib
     191  handleLib = lt_dlopenadvise( libraryPath, advise );
     192 
     193  // se retorna al directorio de trabajo (cwd) inicial
     194  BDir::ChangeCurrent(currentDir);
     195
     196  if ( !handleLib )
     197  {
     198  //Std(BText("\nTRACE BLoadDynLib::Evaluator 3 lt_dlerror='")+lt_dlerror()+"'");
     199    BText reason( lt_dlerror( ) );
     200    Error(BText("[LoadDynLib(\"")+libraryPath+"\")]"+" \n"
     201    "  lt_dlopen error:'"+reason+"'");
     202    contens_ = false;
     203  }
     204  else
     205  {
     206    contens_ = true;
     207  }
     208  if ( advise )
     209    {
     210    lt_dladvise_destroy( &advise );
     211    }
     212}
     213
    125214
    126215//--------------------------------------------------------------------
  • tol/tol_version_def.h

    rd5e4e94 rb22a1e2  
    2323////////////////////////////////////////////////////////////////////////////////////
    2424#define VERSION_MAJOR   3
    25 #define VERSION_MINOR   2
    26 #define VERSION_BUILD   "b021"
     25#define VERSION_MINOR   5
     26#define VERSION_BUILD   "b000"
    2727
    2828#if defined(_MSC_VER)
Note: See TracChangeset for help on using the changeset viewer.