Skip to content

Tracking issue for RFC 2137: Support defining C-compatible variadic functions in Rust  #44930

Open
Listed in
@aturon

Description

@aturon
Member

This is a tracking issue for the RFC "Support defining C-compatible variadic functions in Rust" (rust-lang/rfcs#2137).

Steps:

Unresolved questions:

Activity

added
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
T-langRelevant to the language team
on Sep 29, 2017
plietar

plietar commented on Sep 29, 2017

@plietar
Contributor

I'd like to work on this, I already have some prototype

aturon

aturon commented on Sep 29, 2017

@aturon
MemberAuthor

Awesome @plietar! It'd probably be good to bring this up in the "middle-end" compiler working group channel, which would also be a good place to get any help you might need.

joshtriplett

joshtriplett commented on Nov 23, 2017

@joshtriplett
Member

@plietar How goes the implementation? I remember you showing a mostly complete prototype on IRC.

thedataking

thedataking commented on Feb 14, 2018

@thedataking

@plietar any news to share? This is a blocker for teams working on C to Rust transpilers, so this addition would be very welcome. (I'm part of one such team).

plietar

plietar commented on Feb 22, 2018

@plietar
Contributor

Hey,
Sorry I've been busy and then forgot about this. I'll get my prototype back in shape, hopefully by this weekend.

harpocrates

harpocrates commented on Mar 16, 2018

@harpocrates
Contributor

@plietar Any update on this? Do you have a WIP branch I can check out to try / fiddle with this?

dlrobertson

dlrobertson commented on Mar 20, 2018

@dlrobertson
Contributor

Looks like I'm a little late to the party 😄 ... sorry about that

A few questions:

  1. How would functions that use a va_list multiple times work without the ability to explicitly use va_start and va_end? Are they expected to use copy? E.g. execl typically loops through the arguments to to get argc, creats a array argv of size argc, loops through the list again populating argv, and finally call execv.

  2. The structure of a va_list varies greatly between the architectures. The intrinsic functions work with the architecture specific structure bitcast to an i8*, but AFAIK we'll still need to define the structure. Which architectures will be expected to be supported in the first iteration? Or am I mistaken that we'll have to define the structure?

@plietar if you don't have the time to work on this any more or if there is any way I could help out, I'd be more than happy to do so. I haven't worked on rustc much, but I'd be happy to help however I can with the implementation of this.

nikomatsakis

nikomatsakis commented on Mar 20, 2018

@nikomatsakis
Contributor

@dlrobertson

Seems likely that @plietar doesn't have much time, though they can speak for themselves.

I've not really looked closely at what would be needed to implement this, but if you need any help, please ping me, or reach out on gitter/IRC.

242 remaining items

Loading
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

    A-FFIArea: Foreign function interface (FFI)B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-c_variadic`#![feature(c_variadic)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cuviper@alexreg@eddyb@pervognsen@jondo2010

        Issue actions

          Tracking issue for RFC 2137: Support defining C-compatible variadic functions in Rust · Issue #44930 · rust-lang/rust