binaryninja.types.preprocess_source

preprocess_source(source, filename=None, include_dirs=[])[source]

preprocess_source run the C preprocessor on the given source or source filename.

Parameters:
  • source (str) – source to preprocess
  • filename (str) – optional filename to preprocess
  • include_dirs (list(str)) – list of string directorires to use as include directories.
Returns:

returns a tuple of (preprocessed_source, error_string)

Return type:

tuple(str,str)

Example:
>>> source = "#define TEN 10\nint x[TEN];\n"
>>> preprocess_source(source)
('#line 1 "input"\n\n#line 2 "input"\n int x [ 10 ] ;\n', '')
>>>