Skip to content

Commit

Permalink
build_java.sh: Link against static DDlog library.
Browse files Browse the repository at this point in the history
When linking JNI against DDlog program that was compiled with both
static and dynamic libraries, use the `-static` linker option to link
against the static version.
  • Loading branch information
ryzhyk committed Mar 2, 2020
1 parent 8ece314 commit ff23ed7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion java/build_java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function compile {
# Compile Java program
javac -encoding utf8 -Xlint:unchecked ${JAVAPROG}
# Create a shared library containing all the native code: ddlogapi.c, ${DLPROG}_ddlog.a
${CC} -std=gnu11 -shared -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/${JDK_OS} -I${DLDIR}/${DLPROG}_ddlog -I../../lib ../ddlogapi.c -L${DLDIR}/${DLPROG}_ddlog/target/${BUILD}/ -l${DLPROG}_ddlog -o libddlogapi.${SHLIBEXT}
${CC} -std=gnu11 -shared -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/${JDK_OS} -I${DLDIR}/${DLPROG}_ddlog -I../../lib ../ddlogapi.c -L${DLDIR}/${DLPROG}_ddlog/target/${BUILD} -Wl,-static -l${DLPROG}_ddlog -Wl,-Bdynamic -o libddlogapi.${SHLIBEXT}
}

function cleanup {
Expand Down

0 comments on commit ff23ed7

Please sign in to comment.