Re: Calling Lisp from C (SBCL as a shared object)
"J. Gareth Williams" <[email protected]> Sat, 18 Jan 2025 08:20:31 -0500
| Newsgroups | gmane.lisp.steel-bank.general |
|---|---|
| Message-ID | <CALfqwAq7QdzR-SoTL5ajM600R16RiSGg4LcVjrFJ_pwoj_ruOA@mail.gmail.com> |
Hi Robert,
Appreciate the reply and suggestion! -- but I did try that -- per the
example in the Cookbook -- and I had pretty much the same result. Same
with the example at https://github.com/svetlyak40wt/sbcl-lib.
As soon as I have a non-NIL argument for :callable-exports in the
SAVE-LISP-AND-DIE call, it fails to initialize. I've tried with different
call signatures and return values to no avail.
There was a message in sbcl-bugs this September that raised the same issue:
https://sourceforge.net/p/sbcl/mailman/message/58822085/
Can anyone confirm they're using this successfully on recent SBCL on
Linux? Ideally recent Debian?
Thanks again, Robert.
Gareth
On Sat, Jan 18, 2025, 4:34 a.m. Robert Smith <[email protected]> wrote:
> Try SBCL-LIBRARIAN:
>
> https://github.com/quil-lang/sbcl-librarian
>
> https://lispcookbook.github.io/cl-cookbook/dynamic-libraries.html
>
> Robert
>
>
>
> On Fri, Jan 17, 2025 at 21:02 J. Gareth Williams <[email protected]>
> wrote:
>
>> Hi,
>>
>> I have been struggling to get even a trivial example of
>> DEFINE-ALIEN-CALLABLE to work, and was wondering if anyone could take a
>> look at what I might be doing wrong.
>>
>> Full source:
>> git clone https://gitlab.com/garethw14/simple-sbcl-alien-callable.git
>>
>> It compiles okay and links, but on initialize_lisp(), I land in the
>> debugger:
>>
>> ---
>> In main, about to initialize_lisp()
>>
>> debugger invoked on a SB-KERNEL::UNDEFINED-ALIEN-VARIABLE-ERROR in thread
>> #<THREAD "main thread" RUNNING {10013A8003}>:
>>
>> * Attempt to access an undefined alien variable.*
>> Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
>>
>> restarts (invokable by number or by possibly-abbreviated name):
>> 0: [ABORT] Exit from the current thread.
>>
>> ("foreign function: call_into_lisp_")
>> 0]
>> ---
>>
>> I've tried some other examples I've found around the web, but they seem
>> to yield the same result.
>>
>> Tested on Debian 12.9, SBCL versions 2.5.0 and 2.3.2
>>
>> Would appreciate any insight!
>>
>> gareth
>>
>>
>>
>> _______________________________________________
>> Sbcl-help mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/sbcl-help
>>
>
_______________________________________________
Sbcl-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-help