mplisp

miniPicoLisp with FFI and modules for Buddy BDD library, OpenGL, Gtk and GMP
git clone https://logand.com/git/mplisp.git/
Log | Files | Refs

dl.ffi.c (917B)


      1 /* Generated from dl.ffi using ffi.l */
      2 
      3 #include "../pico.h"
      4 
      5 #include "dlfcn.h"
      6 
      7 any ffi_dlopen(any ex) {
      8    any x = ex, y;
      9    x = cdr(x);
     10    y = EVAL(car(x));
     11    any y1 = xSym(y);
     12    char b1[bufSize(y1)];
     13    bufString(y1, b1);
     14    x = cdr(x);
     15    y = EVAL(car(x));
     16    NeedNum(ex, y);
     17    int b2 = (int) unBox(y);
     18    void* z = dlopen(b1, b2);
     19    return box(z);
     20 }
     21 
     22 any ffi_dlerror(any ex __attribute__((unused))) {
     23    char* z = dlerror();
     24    return mkStr(z);
     25 }
     26 
     27 any ffi_dlsym(any ex) {
     28    any x = ex, y;
     29    x = cdr(x);
     30    y = EVAL(car(x));
     31    NeedNum(ex, y);
     32    void* b1 = (void*) unBox(y);
     33    x = cdr(x);
     34    y = EVAL(car(x));
     35    any y1 = xSym(y);
     36    char b2[bufSize(y1)];
     37    bufString(y1, b2);
     38    void* z = dlsym(b1, b2);
     39    return box(z);
     40 }
     41 
     42 any ffi_dlclose(any ex) {
     43    any x = ex, y;
     44    x = cdr(x);
     45    y = EVAL(car(x));
     46    NeedNum(ex, y);
     47    void* b1 = (void*) unBox(y);
     48    int z = dlclose(b1);
     49    return box(z);
     50 }