13
#define JNI_DECLARE( classname, methodname ) \
     classname  ## methodname( JNI* env ) 

#define JAVA_CLASS Java_com_example
void JNI_DECLARE( JAVA_CLASS, open ) {}

This expands to:

void JAVA_CLASS_open( JNI* env ) {}

How do I get:

void Java_com_example_open( JNI* env ) {}

?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user48956
  • 14,850
  • 19
  • 93
  • 154

1 Answers1

15
#define JNI_DECLARE_INNER( classname, methodname ) \
     classname  ## _ ## methodname( JNI* env )
#define JNI_DECLARE( classname, methodname ) \
     JNI_DECLARE_INNER(classname, methodname)

see more here: C Preprocessor, Stringify the result of a macro

Community
  • 1
  • 1
Karoly Horvath
  • 94,607
  • 11
  • 117
  • 176