Giter Site home page Giter Site logo

Comments (5)

leonardt avatar leonardt commented on June 6, 2024

Task 1 finished in #29

from coreir.

leonardt avatar leonardt commented on June 6, 2024

I imagine the Python interface to look something like

ctx = Context()
stdlib = ctx.load_library("stdlib")

To do this, it could dispatch on the argument to load_library and call the correct function coreir_stdlib.CoreIRLoadLibrary_stdlib(ctx) but either:

  • The coreir library (e.g. stdlib) defines an extern C function and uses the coreir-c opaque types, or
  • The library registers itself with the C-api which holds a map between strings to library function pointers and provides a C-api function coreir_lib.LoadLibrary(ctx, name) which handles converting the Namespace* and Context* between cpp and opaque types.

from coreir.

rdaly525 avatar rdaly525 commented on June 6, 2024

@leonardt In regards to #2, how does the library register itself with the C-api? I think it would still necessarily involve writing an extern C function per library. Unless I am misunderstanding something...

That being said, it would be cool to be able to register library functions which would mean no need for a specific function name standard.

from coreir.

rdaly525 avatar rdaly525 commented on June 6, 2024

@leonardt I just pushed to the clibfix branch (off of libreorg) the addition of the C stdlib api. There are three TODOs (one in lib/libs/stdlib.cpp, two in include/coreir-libs/stdlib.h)

It would be awesome if you could make macros (defined in include/coreir.h) that would macrofy each of the 3 TODOs.

Also now that we have the C api for the libs, you can add them to the python bindings

from coreir.

leonardt avatar leonardt commented on June 6, 2024

README updated -- link
@rdaly525 Should I submit a PR for this branch or are there other fixes pending? I'll wait to close this issue until we merge the branch.

from coreir.

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.