The name about a function called from C code to Java code

I have a function named “Java_com_microej_example_hello_HelloWorld_SNI_CALL_TEST” in C code, and I tried to call it in java code by the name “SNI_CALL_TEST”.
However, the error happend as showed below, then I changed the function’s name to the specified in the KEIL error message–“Java_com_microej_example_hello_HelloWorld_SNI_1CALL_1TEST”, the build got ok and java called the function correctly.
Why do I need to add the Bold characters above to the function’s name in C code? It’s not the right way to use the SNI as described in Example-Standalone-Java-C-Interface.

Hi @MJ163,

The 1 is added because you use an underscore _ in your java method’s name. We need to do so to avoid conflict in our naming convention. The naming convention is defined in the specification of the ESR (Chapter 3.3

We have a tool to generate the function to implements:

  1. Open your .platform
  2. In modules, check Java-to-C -> MicroEJ Java H
  3. Build your platform
  4. Create a new MicroEJ Tool (Run -> Run Configuration)
  5. Select your platform
  6. Select the settings “MicroEJ Java H”
  7. in configuration tab, Go to Classpath
  8. Add the folder where you define your native in java
  9. Run
  10. Your header file will be generated