Giter Club home page Giter Club logo

Comments (4)

timholy avatar timholy commented on June 5, 2024

Hmm, there seem to be more customizations I'd like to make, for example to replace

function somefunction(arg::Ptr{Cint})

with something either untyped or as

function somefunction(arg::Array{Cint})

(this is for functions that return values via pointers). It gets hard to imagine being able to cover the range of possible tweaks through hooks. Perhaps replacing wrap_c.wrap((buf::IO, funcdecl::FunctionDecl, libname::ASCIIString) is the real way to go.

from clang.jl.

ihnorton avatar ihnorton commented on June 5, 2024

Yes, I've thought about this sort of thing - far too much, actually, without just trying something... This comes up for C++ too because I want to inject type translations at various points, for classes or templates that need getter/setter helpers. I might do something like:

type Wrap
  pre_wrap::Function
  ccall_wrap::Function
  post_wrap::Function
  ...
end
Dict{ASCIIString => WrapHelpers}()

The dictionary would be part of WrapContext so you could inject various helpers that way.

But, the ideal solution would probably be to reflect the AST in pure Julia and then provide hooks for people to do pattern matching and transformations on that... Everything is more awkward than it should be right now because the AST is read-only.

I'll see what I can do :)

Your second comment is the reason I suggested disabling type signatures in the function call - then I think it should just work via ccall auto-conversion (not sure about performance).

from clang.jl.

timholy avatar timholy commented on June 5, 2024

It won't have any impact on performance whatsoever. You're right, perhaps removing them is easiest. (I was originally thinking they were extra protection against segfaults, but now I don't think so; ccall itself should complain, I imagine, if the type can't be converted appropriately.)

from clang.jl.

nolta avatar nolta commented on June 5, 2024

#71 basically implements this.

from clang.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.