eliben / pycparser

:snake: Complete C99 parser in pure Python
Other
3.26k stars 612 forks source link

How to parse JNI #461

Closed dry86 closed 2 years ago

dry86 commented 2 years ago

i try to parse some jni.c ,but seem can not detect the rtnType:

pycparser.plyparser.ParseError: data.cpp:34:1: before: Java_com_ibm_cuda_CudaEvent_create

data.cpp:33-36 lines

jlong JNICALL
Java_com_ibm_cuda_CudaEvent_create
  (JNIEnv * env, jclass, jint deviceId, jint flags)
{

how to parse jni by pycparser?

eliben commented 2 years ago

I'm not sure what jni.c is, but the standard guide on getting pycparser to parse some large corpus of C code is https://eli.thegreenplace.net/2015/on-parsing-c-type-declarations-and-fake-headers/

Also check out the README and the Wiki of this repo for additional information