Skip to content

ffi :variadic? true generated function do not use all arguments supplied #449

Open

Description

@mpenet

I get unexpected results when using it.

As an example here is what it outputs from "printf" (defined in stdlib as (def printf (ffi-fn libc "printf" [CCharP] CInt :variadic? true))):

user => (printf "a" "b" "c")
a

It seems everything after the 1st argument is ignored.

Activity

  1. heyLu commented on Nov 15, 2015

    @heyLu
    Member

    Yes, #420 was about the same problem. As I said there, I'm not sure if our FFI can handle the full signature of printf. It seems to support multiple arguments to printf and passes them, but I don't know what happens after that.

    I went looking in pixie/vm/libs/ffi.py, and looked for variadic? there. I think it doesn't actually convert the additional arguments to printf, even though it allocates space for them, it does not convert the additional arguments. (The problem seems to be that _arg_types is used to convert the arguments, but that's just the [CCharP] from the signature, and doesn't include the (unknown) types for the optional arguments.)

  2. mpenet commented on Nov 15, 2015

    @mpenet
    ContributorAuthor

    There is a missing piece yes. I tried briefly to follow what's happening in ffi.py as well but that's still a bit vague to me. I guess that's something @halgari could look into when he gets some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions