Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
// This file:
//   http://anggtwu.net/LISP/hello2.c.html
//   http://anggtwu.net/LISP/hello2.c
//          (find-angg "LISP/hello2.c")
// Author: Eduardo Ochs <eduardoochs@gmail.com>
// Based on this gist:
//   https://gist.github.com/lagagain/df1b97eb08e57c2759c950efc3a2c7dd
// See:
//   http://anggtwu.net/2025-calling-lua-from-common-lisp.html

#include <stdio.h>
#include <stdlib.h>
int  cvar_a = 42;
void cfun_0 (void) { printf("Hello, World\n"); }
void cfun_1 (void) { printf("cvar_a is %d\n", cvar_a); }
void cfun_2 (char *str) { printf("str is %s\n", str); }

/*
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
ls -lAF hello2*
rm -fv  hello2.so*
gcc hello2.c -shared -fPIC -o hello2.so
ls -lAF hello2*

* (eepitch-sbcl)
* (eepitch-kill)
* (eepitch-sbcl)
(load #P"~/quicklisp/setup.lisp")
(ql:quickload :cffi)
(cffi:load-foreign-library "./hello2.so")
(cffi:defcvar ("cvar_a" cvar-a) :int)

(cffi:foreign-funcall "cfun_0")
(cffi:foreign-funcall "cfun_1")
(list cvar-a (setf cvar-a 100) cvar-a)
(cffi:foreign-funcall "cfun_1")
(cffi:foreign-funcall "cfun_2" :string "Foo")

*/