eth0
eth0

Reputation: 5137

How can I pass a preprocessor directive from ctypes?

I have some C code that is wrapped in a preprocessor directive:

#if defined(TEST)
// do stuff
#endif

and I need to execute do stuff from Python via ctypes - is there any way I can define TEST?

Upvotes: 0

Views: 259

Answers (1)

Voo
Voo

Reputation: 30226

This has nothing at all to do with ctypes or python. ctypes only deals with already compiled libraries and allows you to call functions in them. If you want to execute a function that is only conditionally defined you'll have to compile the library with the right directives set.

In gcc that would be something like gcc -D TEST <rest as usual>

Upvotes: 2

Related Questions