Summary

define-external does not grok "const" qualifier

Metadata

Attachments

Description

I believe the following program should show "bar" when run, but it shows #<pointer 0x401f01>

 #!scm
 (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.

Changes and comments

[2011-03-19 18:20:30 UTC] felix changed status from new to closed

[2011-03-19 18:20:30 UTC] felix set resolution to fixed

[2011-04-10 17:34:15 UTC] sjamaan changed status from closed to reopened

[2011-04-10 17:34:15 UTC] sjamaan removed resolution fixed

[2011-04-10 17:34:15 UTC] sjamaan wrote:

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

[2011-04-10 19:36:13 UTC] sjamaan wrote:

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

[2011-04-10 19:44:38 UTC] sjamaan attached const-fix.patch (description=syntax stripping for "const" specifier and possibly others )

[2011-04-11 08:42:22 UTC] felix changed status from reopened to closed

[2011-04-11 08:42:22 UTC] felix set resolution to fixed

[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0

[2011-06-01 09:00:41 UTC] felix wrote:

Milestone 4.7.0 deleted

[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0

[2012-09-24 21:47:48 UTC] felix wrote:

Milestone 4.8.0 deleted