とりあえずこんな感じで、libffiを使って #uselib 対応出来そうです。
Linux版のhspcmpはuselib使うと何かおかしいので、Windows版でax作ってLinux版で実行してみてください。
Ubuntu x86_64では動いてて、同じソースでラズパイOS 32bit/64bitも動くと楽しいんですがどうでしょう?
https://github.com/zakki/OpenHSP-fork/tree/plugin-ffi
#uselib "test.so"
#cfunc test0 "func0"
#cfunc test1 "func1" var,int,int,int
repeat 10
mes "call test0"
res=test0()
mes "return " + res
a = "abc"
mes "call test1"
res=test1(a,1,2,3)
mes "return " + res
mes res
loop
// gcc -shared -fPIC -o test.so test.cpp
#include <stdio.h>
extern "C" {
int count = 0;
int func0() {
printf("called func0() %d\n", count);
return count++;
}
int func1(char *p0, int p1, int p2, int p3) {
printf("called func1(%p, %d, %d, %d)\n", (void*)p0, p1, p2, p3);
for (int i = 0; i < 10; i++) {
if (p0 && p0[i]) {
printf(" %d: %c\n", i, p0[i]);
} else {
break;
}
}
return p1 + p2 + p3 + 12340000;
}
}