Skip to content

importC fails to translate function alias macros #23143

@0xEAB

Description

@0xEAB

Summary

importC currently fails to translate C macros that define function aliases.

Details

Example

libgmp.h

#include <gmp.h>

app23143.d

import libgmp;

void main() @system
{
	mpz_t foo;
	mpz_init(foo);
}

Compiler output

$ dmd -L-lgmp -I. app23143.d
app23143.d(6): Error: undefined identifier `mpz_init`
    mpz_init(foo.ptr);
    ^

Workaround

alias mpz_init = __gmpz_init;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions