Giter Site home page Giter Site logo

Comments (4)

eqrion avatar eqrion commented on May 20, 2024 1

Forgot to add that the command should probably be:

$ cbindgen -v svg2polylines-ffi/ -c cbindgen.toml -o svg2polylines.h

from cbindgen.

Michael-F-Bryan avatar Michael-F-Bryan commented on May 20, 2024

What's the reason why it can't be found?

My understanding is that cbindgen only deals with source code and the AST. So it'll parse your crate and figure out what files it imports, but because it doesn't use the compiler under the hood it can't resolve any imports from outside your crate.

I'm not sure there's an easy fix for this short of hooking into compiler internals (I actually started writing a guide for doing this), which would constrain cbindgen to nightly because compiler internals are always going to be unstable.

from cbindgen.

eqrion avatar eqrion commented on May 20, 2024

What's the reason why it can't be found?

The issue here is that you are specifying a specific file, instead of a crate. This causes cbindgen to use single source mode which doesn't parse external crates (because it doesn't have context to know where external crates are). A warning here would probably be a good idea.

My understanding is that cbindgen only deals with source code and the AST. So it'll parse your crate and figure out what files it imports, but because it doesn't use the compiler under the hood it can't resolve any imports from outside your crate.

This is partially true. cbindgen can be configured to emulate cargo and rustc's crate searching behavior, without using compiler internals. This only works with crate parsing mode, which is the bug here.

from cbindgen.

eqrion avatar eqrion commented on May 20, 2024

I've added a warning for this in version 0.2.1. Closing this for now as there is a solution.

from cbindgen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.