Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why must my JNI native code be compiled and linked with the -pthread option?

0
Posted

Why must my JNI native code be compiled and linked with the -pthread option?

0

All C/C++ code that uses POSIX threads must be compiled and linked using the C/C++ -pthread option. Otherwise, the resulting program will not execute properly. The Virtual Machine uses POSIX threads. Hence, any JNI native code that uses the JVM uses POSIX threads by default, and so must be compiled and linked using the -pthread option. For more information about the -pthread option, please see the C/C++ man pages.

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123