Affix

 view release on metacpan or  search on metacpan

dyncall/ChangeLog  view on Meta::CPAN

  o moved to hg
  o moved bindings to own repository


Version 0.8 (2014/03/24)

buildsys:
  o big simplification make-based build system, no more distinct GNU and BSD makefiles anymore
  o new, much simpler ./configure for new make-based build-system
  o support for in-source and out-of-source builds for make-based build systems
  o made configure.bat guess x64 as target arch for x64 windows hosts
  o based more sources on portasm generation
dyncall:
  o fix for ARMv7 Thumb-2 code (tested on iPhone 4 CDMA / iOS 6.0.1)
  o bugfixes for -O2 builds for SPARC-v9 and SPARC-v7
  o new optimized call kernel for SPARC-v9 without conditionals
  o bigger refactoring and optimization of MIPS o32
  o x64 optimizations
dyncallback:
  o added callback support for plan9
  o big cleanup, removal of duplicate files after introduction of portasm

dyncall/configure.rc  view on Meta::CPAN

  #echo '  --target-arm-thumb build for ARM architecture platform (THUMB mode)'
  #echo
  #echo '  --tool-pcc         use Portable C Compiler'
  #echo 
  #echo '  --asm-xa           use Plan9 Assemblers (0a, 1a, 2a, etc.)'
  echo
  exit 0
}


# --- guess os, arch, ... -------------------------------------------------

CONFIG_OS=()
fn guess_os {
  CONFIG_OS='plan9'
  info 'guess os '$CONFIG_OS
}

CONFIG_ARCH=()
fn guess_arch {
  CONFIG_ARCH='x86'
  switch($cputype) {
    case 386
      CONFIG_ARCH='x86'
    case amd64
      CONFIG_ARCH='x64'
    case arm
      CONFIG_ARCH='arm32_arm'
    case power
      CONFIG_ARCH='ppc32'
    case mips
      CONFIG_ARCH='mips32'
    case *
      warning 'unknown architecture '$cputype' - using default (x86)'
  }
  info 'guess arch '$CONFIG_ARCH
}

CONFIG_TOOL=()
fn guess_tool {
  #CONFIG_TOOL=`{grep CC /$objtype/mkfile | sed s/CC.//}
  CONFIG_TOOL='pcc'
  info 'guess tool '$CONFIG_TOOL
}

CONFIG_ASM=()
fn guess_asm {
  CONFIG_ASM=`{grep AS /$objtype/mkfile | sed s/AS.//}
  info 'guess assembler '$CONFIG_ASM
}

fn guess {
  if(~ $#CONFIG_OS 0) {
    guess_os
    if(~ $#CONFIG_OS 0) {
      error 'unsupported operating system '$OS
    }
  }

  if(~ $#CONFIG_ARCH 0) {
    guess_arch 
    if(~ $#CONFIG_ARCH 0) {
      error 'unsupported architecture '$ARCH
    }
  }

  if(~ $#CONFIG_TOOL 0) {
    guess_tool
    if(~ $#CONFIG_TOOL 0) {
      error 'no tool'
    }
  }

  if(~ $#CONFIG_ASM 0) {
    guess_asm
    if(~ $#CONFIG_ASM 0) {
      error 'no assembler tool'
    }
  }
}


# --- process arguments ------------------------------------------------------

fn args {

dyncall/configure.rc  view on Meta::CPAN

      case *
        warning 'unknown option '$OPT
    }
  }
}



args $*
info '* configure package '$PACKAGE
guess

CONFIG_HOST=$CONFIG_OS
BUILD_HOST=$CONFIG_HOST
if(! ~ $CONFIG_HOST $CONFIG_OS) {
  BUILD_HOST=$CONFIG_HOST'_'$CONFIG_OS
}

CONFFILE=Makefile.config
echo '#auto-generated by '$PACKAGE'/configure' >$CONFFILE
echo 'CONFIG_PACKAGE='$PACKAGE >>$CONFFILE

dyncall/dynload/dynload_unix.c  view on Meta::CPAN

    }
  }

  return l+1; /* strlen + '\0' */
}


/* - OpenBSD >= 3.7 has dl_iterate_phdr(), as well as glibc >= 2.2.4
   - also some libc impls (like musl) provide dlinfo(), but not RTLD_SELF (see above), however they might come
     with dl_iterate_phdr (which comes from ELF program header iteration), so base it on that
   - skip and use dladdr()-based guessing (see below) if explicitly requested, e.g. by ./configure
   - Haiku/BeOS does have the headers but no implementation of dl_iterate_phdr() (at least as of 2021) */
#elif !defined(DL_DLADDR_TO_LIBPATH) && (defined(OS_OpenBSD) || defined(DL_USE_GLIBC_ITER_PHDR) || (!defined(RTLD_SELF) && defined(__ELF__))) && !defined(OS_BeOS)

#include <sys/types.h>
#include <link.h>

typedef struct {
  DLLib* pLib;
  char*  sOut;
  int    bufSize;

dyncall/dynload/dynload_unix.c  view on Meta::CPAN

/* glibc with neither dl_iterate_phdr() nor dlinfo() (latter introduced after former) @@@
#elif defined(__GLIBC__) && !defined(DL_USE_GLIBC_ITER_PHDR)

@@@impl */

/* fallback to dladdr() hack */
#else

#warning "Using non-optimal code for dlGetLibraryPath() b/c of platform limitations."

/* if nothing else is available, fall back to guessing using dladdr() - this */
/* might not always work, as it's trying to getit via the _fini() symbol,    */
/* which is usually defined in ELF files, but not guaranteed                 */

/* @@@Note: On some platforms this might be improved, e.g. on BeOS we have */
/* lt_dlgetinfo, which requires iterating over ltdl stuff, but was unable  */
/* to get that to work (would also introduce a link dependency on libltdl) */

int dlGetLibraryPath(DLLib* pLib, char* sOut, int bufSize)
{
/*@@@ missing handler for pLib == NULL*/

dyncall/dynload/dynload_windows.c  view on Meta::CPAN

  /* get the path name as wide chars, then convert to UTF-8; we need   */
  /* some trial and error to figure out needed wide char string length */

  wchar_t* ws;
  int r;

  /* num chars to alloc temp space for, and upper limit, must be both power */
  /* of 2s for loop to be precise and to test allow testing up to 32768 chars */
  /* (including \0), which is the extended path ("\\?\...") maximum */
  static const int MAX_EXT_PATH = 1<<15; /* max extended path length (32768) */
  int nc = 1<<6;                         /* guess start buffer size, */

  while(nc <= MAX_EXT_PATH)/*@@@ add testcode for super long paths*/
  {
    ws = (wchar_t*)dlAllocMem(nc * sizeof(wchar_t));
    if(!ws)
      break;

    r = GetModuleFileNameW((HMODULE)pLib, ws, nc);

    /* r == nc if string was truncated, double temp buffer size */

dyncall/test/dynload_plain/dynload_plain.c  view on Meta::CPAN

  DLSyms* pSyms;
  const char* path = NULL;
  int cmp_inode = 1;

  /* hacky/lazy list of some clib paths per platform - more/others, like version-suffixed ones */
  /* can be specified in Makefile; this avoids trying to write portable directory traversal stuff */
  const char* clibs[] = {
#if defined(DEF_C_DYLIB)
    DEF_C_DYLIB,
#endif
    /* fallback guessing if not provided by Makefile */
    "/lib/libc.so",
    "/lib32/libc.so",
    "/lib64/libc.so",
    "/usr/lib/libc.so",
    "/usr/lib/system/libsystem_c.dylib", /* macos - note: not on fs w/ macos >= 11.0.1 */
    "/usr/lib/libc.dylib",
    "/boot/system/lib/libroot.so",       /* Haiku */
    "\\ReactOS\\system32\\msvcrt.dll",   /* ReactOS */
    "C:\\ReactOS\\system32\\msvcrt.dll",
    "\\Windows\\system32\\msvcrt.dll",   /* Windows */

eg/benchmark.pl  view on Meta::CPAN

        }
        my $thing = sub {
            dcReset($cvm);
            $funcs[$_]->( $cvm, $_[$_] ) for 0 .. $#funcs;
            $ret->( $cvm, $ptr );
        };
        bless $thing, $package;
    }

    sub load ( $path, $version = () ) {
        dlLoadLibrary( guess_library_name( $path, $version ) );
    }
    sub func ( $lib, $symbol ) { dlFindSymbol( $lib, $symbol ); }
    our $OS = $^O;

    sub guess_library_name ( $name = (), $version = () ) {
        ( $name, $version ) = @$name if ref $name eq 'ARRAY';
        $name // return ();    # NULL
        return $name if -f $name;
        CORE::state $_lib_cache;
        my @retval;
        ($version) = version->parse($version)->stringify =~ m[^v?(.+)$];

        # warn $version;
        $version = $version ? qr[\.${version}] : qr/([\.\d]*)?/;
        if ( !defined $_lib_cache->{ $name . chr(0) . ( $version // '' ) } ) {



( run in 0.617 second using v1.01-cache-2.11-cpan-ba35b6b0368 )