# Getting preprocessor directives from a C library

**URL:** <https://discourse.julialang.org/t/getting-preprocessor-directives-from-a-c-library/5128>\
**Category:** New to Julia\
**Created:** [July 29, 2017, 10:17pm UTC](https://discourse.julialang.org/t/getting-preprocessor-directives-from-a-c-library/5128 "2017-07-29T22:17:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bovine3dom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bovine3dom/32/4881_2.png) [@bovine3dom](https://discourse.julialang.org/u/bovine3dom)\
**Post date:** [July 29, 2017, 10:17pm UTC](https://discourse.julialang.org/t/getting-preprocessor-directives-from-a-c-library/5128/1 "2017-07-29T22:17:23Z")

</div>

Hi,

I’m trying to use a C library in Julia. As part of it, I need/would like to access some variables / “functions” that are defined like so:

```nohighlight
#define FOO 1
#define BAR(a,b) (int)(a+b)

```

`cglobal` and `ccall` give me errors like “could not load symbol” and and “could not find function”. They work for ‘actual’ functions in the library.

Is it just not possible to access these values?

Sorry if it’s a silly question - I really don’t know what I’m doing when it comes to C.

Thanks!

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [July 30, 2017, 12:28am UTC](https://discourse.julialang.org/t/getting-preprocessor-directives-from-a-c-library/5128/2 "2017-07-30T00:28:49Z")

</div>

> [@bovine3dom](#):
>
> Is it just not possible to access these values?

Correct. They are only availabe in the header so you need something that look at the header for that.  
Cxx.jl should handle that. Other C compiler/clang based solution might too. (CxxWrap.jl and to a less degree Clang.jl)

---

<div class="post-metadata">

**Author:** ![bovine3dom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bovine3dom/32/4881_2.png) [@bovine3dom](https://discourse.julialang.org/u/bovine3dom)\
**Post date:** [July 30, 2017, 9:39am UTC](https://discourse.julialang.org/t/getting-preprocessor-directives-from-a-c-library/5128/3 "2017-07-30T09:39:11Z")

</div>

Thanks, that lead me to [https://juliacomputing.com/blog/2017/02/21/finding-ioctls-with-cxx.html](https://juliacomputing.com/blog/2017/02/21/finding-ioctls-with-cxx.html) which does what I want.
