Skip to content

Variadic native functions #2057

Closed
@nikomatsakis

Description

@nikomatsakis
Contributor

We should support variadic native functions like objc_msgSend() or printf().

Activity

catamorphism

catamorphism commented on Apr 22, 2013

@catamorphism
Contributor

Nominating for "maturity #3 - feature complete"

emberian

emberian commented on Jul 12, 2013

@emberian
Member

Triage bump

catamorphism

catamorphism commented on Oct 24, 2013

@catamorphism
Contributor

Low, not 1.0

lilyball

lilyball commented on Nov 5, 2013

@lilyball
Contributor

For the record, objc_msgSend() is not a variadic function. It's a hand-coded assembly trampoline that finds the real function and calls it. The real function uses normal C calling conventions, not varargs conventions (unless, of course, it actually includes varargs itself).

When using objc_msgSend() directly in code, you must cast it to the appropriate type. For example, in order to call a theoretical method -[NSObject setInteger:(int)i] you need to say

((void(*)(id,SEL,int))objc_msgSend)(obj, @selector(setInteger:), i);
added a commit that references this issue on Apr 23, 2024

Auto merge of rust-lang#3461 - tiif:add_localtime_r_shim, r=RalfJung

added a commit that references this issue on Jul 29, 2024

Auto merge of rust-lang#3743 - newpavlov:pread_pwrite, r=RalfJung

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-codegenArea: Code generationA-type-systemArea: Type systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @lilyball@nikomatsakis@catamorphism@emberian

      Issue actions

        Variadic native functions · Issue #2057 · rust-lang/rust