Skip to content

Linking to multiple ffi crates fails #980

@seftontycho

Description

@seftontycho

I have two crates that use cbindgen to generate bindings for c++.
When I try to build the C++ project with both crates on windows I get the following errors:

06:24:17   analogue_dropouts.lib(alloc-7bfd0a6d1a588dbd.alloc.a1e7c519547c97d-cgu.0.rcgu.o) : error LNK2005: __rdl_oom already defined in language_identification.lib(alloc-f7d2d3884e227169.alloc.e369825d162945b2-cgu.0.rcgu.o)
06:24:17   analogue_dropouts.lib(std-8ac42145e0282c2a.std.184ed18d6ec46d5f-cgu.0.rcgu.o) : error LNK2005: __rdl_alloc already defined in language_identification.lib(std-0953e6946d141dd5.std.1acf644841c643e8-cgu.0.rcgu.o)
06:24:17   analogue_dropouts.lib(std-8ac42145e0282c2a.std.184ed18d6ec46d5f-cgu.0.rcgu.o) : error LNK2005: __rdl_dealloc already defined in language_identification.lib(std-0953e6946d141dd5.std.1acf644841c643e8-cgu.0.rcgu.o)

It looks like some parts of alloc and std are present in both (which makes sense) causing a conflict.
How can I get around this?

My cbindgen.toml looks like the following:

include_guard = "ANALOGUE_DROPOUTS_HPP"

autogen_warning = "/* This file is autogenerated by cbindgen. Don't modify this file manually. */"

namespace = "ffi"

pragma_once = true

[parse]
expand = ["analogue_dropouts"]

[export]
prefix = "analogue_dropouts_"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions