gpakosz/whereami

Linux: wai_getModulePath() returns executable path

darealshinji opened this issue · 1 comments

I've built the examples using the GNU makefile but the module path always equals the executable path:

 $ whereami/bin/linux-x86_64/executable
executable path: /home/djcj/Downloads/whereami/bin/linux-x86_64/executable
  dirname: /home/djcj/Downloads/whereami/bin/linux-x86_64
  basename: executable
module path: /home/djcj/Downloads/whereami/bin/linux-x86_64/executable
  dirname: /home/djcj/Downloads/whereami/bin/linux-x86_64
  basename: executable
 $ whereami/bin/linux-x86_64/executable-cpp 
executable path: /home/djcj/Downloads/whereami/bin/linux-x86_64/executable-cpp
  dirname: /home/djcj/Downloads/whereami/bin/linux-x86_64
  basename: executable-cpp
module path: /home/djcj/Downloads/whereami/bin/linux-x86_64/executable-cpp
  dirname: /home/djcj/Downloads/whereami/bin/linux-x86_64
  basename: executable-cpp

OS: Ubuntu MATE 22.04.1 LTS x86_64
Kernel: 5.15.0-58-generic
gcc: 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

I see, I had to call is with --load-library=./library.so:

$ ./executable --load-library=./library.so
executable path: /home/djcj/Downloads/whereami/bin/linux-x86_64/executable
 dirname: /home/djcj/Downloads/whereami/bin/linux-x86_64
 basename: executable
module path: /home/djcj/Downloads/whereami/bin/linux-x86_64/executable
 dirname: /home/djcj/Downloads/whereami/bin/linux-x86_64
 basename: executable

library loaded
executable path: /home/djcj/Downloads/whereami/bin/linux-x86_64/executable
 dirname: /home/djcj/Downloads/whereami/bin/linux-x86_64
 basename: executable
module path: /home/djcj/Downloads/whereami/bin/linux-x86_64/library.so
 dirname: /home/djcj/Downloads/whereami/bin/linux-x86_64
 basename: library.so
library unloaded