#541 closed defect (fixed)
define-external does not grok "const" qualifier
| Reported by: | sjamaan | Owned by: | felix winkelmann |
|---|---|---|---|
| Priority: | minor | Milestone: | 4.9.0 |
| Component: | compiler | Version: | 4.6.x |
| Keywords: | ffi | Cc: | |
| Estimated difficulty: |
Description
I believe the following program should show "bar" when run, but it shows #<pointer 0x401f01>
(define-external (print_foo ((const c-string) foo)) void (print foo)) ((foreign-safe-lambda* void () "print_foo(\"bar\");"))
If I remove the const qualifier, it works.
Attachments (1)
Change History (7)
comment:1 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 Changed 15 years ago by
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
comment:3 Changed 15 years ago by
Here's a patch. It would be nice if this could make it into the new release.
Changed 15 years ago by
| Attachment: | const-fix.patch added |
|---|
syntax stripping for "const" specifier and possibly others
comment:4 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Note: See
TracTickets for help on using
tickets.

The fix for this bug doesn't work in the general case. I think it's missing a strip-syntax:
(define-syntax generate-external (syntax-rules () ((_) (define-external (print_foo ((const c-string) foo)) void (print foo))))) (generate-external) ((foreign-safe-lambda* void () "print_foo(\"bar\");"))