Shared Library Path as Executable Directory

前端 未结 2 836
醉话见心
醉话见心 2021-02-04 09:14

I have an application that is broken into several libraries for purposes of code reuse. On Windows all I have to do is put the .dll files in the same path as the executable and

2条回答
  •  醉梦人生
    2021-02-04 09:47

    Wrap your program in a shell script:

    #!/bin/sh
    
    PROGRAM_DIRECTORY="`dirname "$0"`"
    export LD_LIBRARY_PATH="$PROGRAM_DIRECTORY"
    
    "$PROGRAM_DIRECTORY/program_executable" "$@"
    

    If you run this script (instead of your executable) your program will link just fine.

提交回复
热议问题