Re: examples for crunch/C interopt
Ben <[email protected]>
| Newsgroups | gmane.lisp.scheme.chicken |
|---|---|
| Message-ID | <[email protected]> |
Hi
Thanks to your help I was able to install the latest chicken crunch compiler and I was even able you raylib example. Thanks alot.
If you dont mind I have another issue as I would like to furter examine the following macro of yours. When I try to see what the `get-constant` macro returns I get an Error:
(get-constant "KEY_ENTER")
Error: illegal non-atomic object: ()
```
$> ~/Builds/crunch-scheme/crunch-scheme/bin/csi
(import (scheme base))
(import (chicken syntax))
(import (crunch c)
(crunch memory) )
#;1> (import (scheme base))
(import (chicken syntax))
(import (crunch c)
(crunch memory) ) #;2> #;3>
; loading /Users/ben/Builds/crunch-scheme/crunch-scheme/lib/chicken/12/crunch.c.import.so ...
; loading /Users/ben/Builds/crunch-scheme/crunch-scheme/lib/chicken/12/crunch.memory.import.so ...
; loading /Users/ben/Builds/crunch-scheme/crunch-scheme/lib/chicken/12/crunch.c.so ...
; loading /Users/ben/Builds/crunch-scheme/crunch-scheme/lib/chicken/12/crunch.memory.so ...
(define-syntax get-constant
(er-macro-transformer
(lambda (x r c)
`((,(r 'c-lambda) () integer ,(string-append "return(" (cadr x) ");"))))))
(get-constant "KEY_ENTER")
Error: illegal non-atomic object: ()
inside expression `(##core#c-lambda ...)'
Call history:
<stdin>:10 (get-constant "KEY_ENTER")
<eval> (##sys#list (##sys#list (r (quote c-lambda)) (##core#quote ()) (##core#quote integer) (string-append...
<eval> (##sys#list (r (quote c-lambda)) (##core#quote ()) (##core#quote integer) (string-append "return(" (...
<stdin>:8 (r (quote c-lambda))
<stdin>:8 (string-append "return(" (cadr x) ");")
<stdin>:8 (cadr x)
<syntax> ((c-lambda50 () integer "return(KEY_ENTER);"))
<stdin>:10 (c-lambda50 () integer "return(KEY_ENTER);")
<stdin>:10 (##core#c-lambda integer () ("return(KEY_ENTER);")) <--
```
Can you see the problem?
Thanks
On Thu, Dec 5, 2024, at 10:46 AM, [email protected] wrote:
>> Hi
>> Just a general thought from a beginner: It would be very cool to have a few examples showing like crunch call c functions and values. For example a simple hello world with raylib would be immensely helpful to me.
>> Thanks in advance
>>
>
> Find attached a port a one of the simpler raylib examples. Tested on
> OpenBSD only, though.
>
> Note that you need the newest CHICKEN master version and CRUNCH 0.5, as
> (naturally)
> I found some more bugs...
>
> Hope this helps.
>
>
> cheers,
> felix
>
> Attachments:
> * core_basic_screen_manager.scm