Popularity
7.7
Declining
Activity
0.0
Declining
39
9
6
Programming language: Crystal
License: GNU General Public License v3.0 or later
Tags:
C Bindings
Latest version: v0.3.0
clang.cr alternatives and similar shards
Based on the "C bindings" category.
Alternatively, view clang.cr alternatives based on common mentions on social networks and blogs.
-
asound-cr
ALSA/libasound bindings for sound programming in Crystal language.
Clean code begins in your IDE with SonarLint
Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.
Promo
www.sonarlint.org
Do you think we are missing an alternative of clang.cr or a related project?
README
libclang bindings for Crystal
Usage:
require "clang"
index = Clang::Index.new
files = [
#Clang::UnsavedFile.new("input.c", "#include <pcre.h>\n"),
Clang::UnsavedFile.new("input.c", "#include <clang/Basic/ABI.h>\n"),
]
tu = Clang::TranslationUnit.from_source(index, files, [
"-I/usr/include",
"-I/usr/lib/llvm-5.0/include",
])
tu.cursor.visit_children do |cursor|
p cursor
Clang::ChildVisitResult::Continue
end
Samples
See the samples
folder for some example usages:
samples/debug.cr
will print the AST of C or C++ headers as they are parsed;samples/c2cr.cr
will automatically generate Crystal bindings for a C header.
For example:
$ shards build --release
$ bin/c2cr -I/usr/lib/llvm-5.0/include llvm-c/Core.h \
--remove-enum-prefix=LLVM --remove-enum-suffix > llvm-c/Core.cr
$ bin/c2cr -I/usr/lib/llvm-5.0/include clang-c/Index.h \
--remove-enum-prefix > clang-c/Index.cr
$ bin/c2cr gtk-2.0/gtk/gtkenums.h --remove-enum-prefix > gtk/enums.cr
Reference
License
Distributed under the Apache 2.0 license.
*Note that all licence references and agreements mentioned in the clang.cr README section above
are relevant to that project's source code only.