Giter Club home page Giter Club logo

Comments (5)

Gnimuc avatar Gnimuc commented on June 5, 2024 3

For long-term julia support and maintenance, the utilities provided by bootstrap.cpp may need to be split into different parts.

Cxx.jl is based on LLVM and Clang. As for the LLVM part, I guess we can use LLVM.jl(LLVM's C API wrapper) to reimplement related functionalities in bootstrap.cpp. LLVM.jl is well-maintained and stable between Julia versions, so there will be no maintenance overhead for the long-term.

As for the Clang part, unfortunately, libclang(Clang's stable C API) doesn't provide enough features that are needed by Cxx.jl(Cxx.jl uses Clang's codegen to generate LLVM IR from C++ code, but libclang is mainly for doing things with the AST), so I think we need a C++ library that provides stable C API for Clang's codegen module. For the long-term maintenance, we only need to do bugfixes on this library for different Clang versions, nothing needs to be done on the Cxx.jl side.

As for the Julia part, I believe we should implement Cxx.jl by using Julia's internal interfaces as little as possible. If it's inevitable to use some internal functions, one needs to submit PRs to the upstream to make sure all of them are available between Julia versions.

As for the build system, we now have Clang_jll in Yggdrasil, so it's easy to upgrade the build system to BB2.

Anyway, these are my two cents about the long-term support of this package. I haven't actively worked on this package for quite a while until recently, I'm starting to play with the Clang part.

from cxx.jl.

Gnimuc avatar Gnimuc commented on June 5, 2024 3

what would you advise someone that wants to interface a C++ library to do? I would appreciate if you could give an answer for both someone starting from scratch and for someone that has already some implemented code using Cxx.jl.

For the sake of stability, I highly recommended starting with CxxWrap.jl for now. For those who have Cxx-based packages, if the package is only for personal use and Cxx is working fine and there is no need for new features introduced in Julia 1.4+(e.g. the new multithreading feature), then I guess it's ok to stick with Cxx. Or one could switch to CxxWrap.jl when users complain about the Julia version limitation.

There are two main features provided by Cxx.jl: the @cxx macro, and the icxx/cxx macro. It looks like the implementation of the icxx/cxx macro is much simpler than the @cxx macro, so I would expect that we could get a stable icxx/cxx macro for Julia 1.6+ in the near future.

As I'm not an active user of Cxx.jl, I don't really know the use case where one should prefer @cxx over icxx/cxx. To me, the use case is somehow overlapped.

Sorry if I am being pushy. It's not my intention. I would appreciate an answer whenever you have the time. I am just struggling to find the best way to make the most out of my (current and future) Julia packages.

Never mind. Learning to make Cxx.jl work on Julia 1.6+ is high on my priority list. :)

from cxx.jl.

oschulz avatar oschulz commented on June 5, 2024 3

I don't really know the use case where one should prefer @cxx over icxx/cxx. To me, the use case is somehow overlapped.

In my experience (not using Cxx at the moment since I need a recent Julia, but I did use it a lot in the past), the icxx/cxx macros are a lot more important than having @cxx - the latter is a nice convenience, but non-trivial uses cases will often require icxx/cxx in many places. So I think if a Julia v1.6 compatible version without @cxx would be very nice already.

from cxx.jl.

gstavrinos avatar gstavrinos commented on June 5, 2024

Thank you for the detailed answer, @Gnimuc. It is much appreciated. I now understand the limits and hurdles of the Cxx.jl package.

I can't say I completely understood what you meant with "As for the build system, we now have Clang_jll in Yggdrasil, so it's easy to upgrade the build system to BB2.", but it's ok.

Since you know and are involved in the JuliaInterop organization, what would you advise someone that wants to interface a C++ library to do? I would appreciate if you could give an answer for both someone starting from scratch and for someone that has already some implemented code using Cxx.jl.

Sorry if I am being pushy. It's not my intention. I would appreciate an answer whenever you have the time. I am just struggling to find the best way to make the most out of my (current and future) Julia packages.

Thanks again.

from cxx.jl.

gstavrinos avatar gstavrinos commented on June 5, 2024

Thank you again for another detailed answer.

For my current packages I think I will stick with Cxx.jl since there are plans for further development and Julia 1.6+ support. For my new packages I will try (once more) to implement them in CxxWrap.jl although the C++ interface is not as friendly.

I am closing this issue. Feel free to re-open it if you need the visibility of the discussion.

Thank you very much.

from cxx.jl.

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.