[cfe-dev] Use of libclang in OS X application
Jacob Carlborg via cfe-dev
cfe-dev at lists.llvm.org
Mon Dec 14 09:40:44 PST 2015
On 2015-12-14 18:14, vivek pandya via cfe-dev wrote:
> Hello ,
> I want to use libclang with Swift in OS X application. Please suggest me
> whether I should use static(.a) or dynamic(.dylib) libclang ? In both
> the case what are the other dependencies needs to be included ? If I use
> .dylib version then Can it be distributed as a single executable which
> is independent and deployed on OS X machine which do not have XCode or
> clang installed ?
Clang itself is not required but its internal headers are required. They
way I solved this in my tool  was to include (some of) the headers in
the executable itself and then used CXUnsavedFile to create something
like a virtual file. The the path to the virtual file is added by the
tool to the command line arguments used by libclang to parse the
Perhaps not ideal, but that's the best I could think of.
> I have build static libclang with |cmake -DLIBCLANG_BUILD_STATIC=ON but
> it generated both for me .a and .dylib . Why size of .dylib is greater
> than .a file ?
If there's a big difference I would guess the static library depends on
other (Clang/LLVM) libraries that need to be linked as well.
More information about the cfe-dev