--- gforth/prim 2008/07/15 16:11:49 1.230 +++ gforth/prim 2008/09/18 02:42:24 1.235 @@ -1674,7 +1674,7 @@ supported on your machine (take a look a your machine has a separate instruction cache. In such cases, @code{flush-icache} does nothing instead of flushing the instruction cache."" -FLUSH_ICACHE(c_addr,u); +FLUSH_ICACHE((caddr_t)c_addr,u); (bye) ( n -- ) gforth paren_bye SUPER_END; @@ -1777,11 +1777,21 @@ 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; +#ifdef HAS_LINKBACK ((void (*)())w)(); +#else +((void (*)(void *))w)(gforth_pointers); +#endif sp=gforth_SP; fp=gforth_FP; +rp=gforth_RP; +lp=gforth_LP; +IF_fpTOS(fpTOS=fp[0]); \+ \+file @@ -2393,7 +2403,7 @@ r = fp[u]; \g syslib open-lib ( c_addr1 u1 -- u2 ) gforth open_lib -#if 1 +#ifdef HAVE_LIBLTDL u2 = (UCell)lt_dlopen(tilde_cstr(c_addr1, u1, 1)); #elif defined(HAVE_LIBDL) || defined(HAVE_DLOPEN) #ifndef RTLD_GLOBAL @@ -2410,7 +2420,7 @@ u2 = 0; #endif lib-sym ( c_addr1 u1 u2 -- u3 ) gforth lib_sym -#if 1 +#ifdef HAVE_LIBLTDL u3 = (UCell) lt_dlsym((lt_dlhandle)u2, cstr(c_addr1, u1, 1)); #elif defined(HAVE_LIBDL) || defined(HAVE_DLOPEN) u3 = (UCell) dlsym((void*)u2,cstr(c_addr1, u1, 1)); @@ -2454,8 +2464,13 @@ l! ( w c_addr -- ) gforth l_store 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); +#ifdef HAVE_LIBLTDL +c_addr = (Char *)lt_dlerror(); +u = (c_addr == NULL) ? 0 : strlen((char *)c_addr); +#else +c_addr = "libltdl is not configured"; +u = strlen(c_addr); +#endif \+ \g peephole