Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ffigen] Variadic arguments with function types. #1732

Open
dcharkes opened this issue Nov 18, 2024 · 2 comments
Open

[ffigen] Variadic arguments with function types. #1732

dcharkes opened this issue Nov 18, 2024 · 2 comments

Comments

@dcharkes
Copy link
Collaborator

@dcharkes is there a way to do variadic arguments that are functions? trying to generate libcurl bindings

CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);

and a version of the function accepts a

static size_t curl_callback(char *data, size_t size, size_t nmemb, void *clientp)
 functions:
    variadic-arguments:
      curl_easy_setopt:
        - [ 'long' ]
        - [ 'char*' ]
        - [ 'curl_off_t' ]
        - [ 'size_t curl_callback(char *data, size_t size, size_t nmemb, void *clientp)' ] <- this is what i want to somehow represent

Originally posted by @kingwill101 in #238 (comment)

@liamappelbe I suppose we don't support defining new types yet?

Now that we're starting to move into the visitor-world instead of yaml-config-world, could we conceivably add something for that?

@kingwill101 A possible work around would be to make a typedef for the function type in a separate header file, and add that header file to your FFIgen config, and use the typedef name as the type.

@kingwill101
Copy link

@kingwill101 A possible work around would be to make a typedef for the function type in a separate header file, and add that header file to your FFIgen config, and use the typedef name as the type.

I believe I tried that approach and it didn't work. Will give it another shot

@liamappelbe
Copy link
Contributor

@liamappelbe I suppose we don't support defining new types yet?

Now that we're starting to move into the visitor-world instead of yaml-config-world, could we conceivably add something for that?

Yeah, that's doable. It's not a small feature though. I'm not sure when I'll have time to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants