--- gforth/prim 2008/05/05 13:37:20 1.227 +++ gforth/prim 2008/07/27 09:58:29 1.231 @@ -1,6 +1,6 @@ \ Gforth primitives -\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007 Free Software Foundation, Inc. +\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. \ This file is part of Gforth. @@ -1777,11 +1777,17 @@ access the stack itself. The stack point variables @code{gforth_SP} and @code{gforth_FP}."" /* This is a first attempt at support for calls to C. This may change in the future */ +IF_fpTOS(fp[0]=fpTOS); gforth_FP=fp; gforth_SP=sp; +gforth_RP=rp; +gforth_LP=lp; ((void (*)())w)(); sp=gforth_SP; fp=gforth_FP; +rp=gforth_RP; +lp=gforth_LP; +IF_fpTOS(fpTOS=fp[0]); \+ \+file @@ -2394,15 +2400,15 @@ r = fp[u]; open-lib ( c_addr1 u1 -- u2 ) gforth open_lib #if 1 -u2 = (UCell)lt_dlopen(cstr(c_addr1, u1, 1)); +u2 = (UCell)lt_dlopen(tilde_cstr(c_addr1, u1, 1)); #elif defined(HAVE_LIBDL) || defined(HAVE_DLOPEN) #ifndef RTLD_GLOBAL #define RTLD_GLOBAL 0 #endif -u2=(UCell) dlopen(cstr(c_addr1, u1, 1), RTLD_GLOBAL | RTLD_LAZY); +u2=(UCell) dlopen(tilde_cstr(c_addr1, u1, 1), RTLD_GLOBAL | RTLD_LAZY); #else # ifdef _WIN32 -u2 = (Cell) GetModuleHandle(cstr(c_addr1, u1, 1)); +u2 = (Cell) GetModuleHandle(tilde_cstr(c_addr1, u1, 1)); # else #warning Define open-lib! u2 = 0; @@ -2453,6 +2459,7 @@ l! ( w c_addr -- ) gforth l_store *(Tetrabyte*)(c_addr) = w; lib-error ( -- c_addr u ) gforth lib_error +""Error message for last failed @code{open-lib} or @code{lib-sym}."" c_addr = lt_dlerror(); u = (c_addr == NULL) ? 0 : strlen(c_addr);