After testing BESEN a bit, I'm still impressed with your work. Thanks for adding support for FPC 2.4.0.

It works without any problems on my Windows machine, but unfortunately I'm having some issues getting it to work on a Mac.
First off, you something like this
[pascal]
{$ifdef fpc}
{$ifdef darwin}
{$pic off}
{$endif}
...
[/pascal]
since -fPic switch is set by default when compiling on a Mac.

BESEN loads dynamically from libc.so. Well, libc.so doesn't exist on Mac, it's called libc.dylib. So around line 41287 please change it to following:
[pascal]
{$ifdef darwin}
fpmprotect:=dlsym(dlopen('libc.dylib',RTLD_NOW),'m protect');
{$else}
fpmprotect:=dlsym(dlopen('libc.so',RTLD_NOW),'mpro tect');
{$endif}
[/pascal]

With those two changes it compile and BESENTest will at least start when being executed, but as soon as I load any script into the sample, I get this error:
Code:
Exception object An unhandled exception occurred at $00043114 :
Illegal instruction

I would love to see some more examples especially in regards on how to integrate BESEN into existing applications, like how to access certain aspects of the application from the script and vice versa.