Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#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)

const-fix.patch (2.0 KB) - added by sjamaan 13 years ago.
syntax stripping for "const" specifier and possibly others

Download all attachments as: .zip

Change History (7)

comment:1 Changed 13 years ago by felix winkelmann

Resolution: fixed
Status: newclosed

comment:2 Changed 13 years ago by sjamaan

Resolution: fixed
Status: closedreopened

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\");"))

comment:3 Changed 13 years ago by sjamaan

Here's a patch. It would be nice if this could make it into the new release.

Changed 13 years ago by sjamaan

Attachment: const-fix.patch added

syntax stripping for "const" specifier and possibly others

comment:4 Changed 13 years ago by felix winkelmann

Resolution: fixed
Status: reopenedclosed

comment:5 Changed 13 years ago by felix winkelmann

Milestone: 4.7.04.8.0

Milestone 4.7.0 deleted

comment:6 Changed 12 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.