D
draco
Hi,
Let's say I have a dynamic library libapple.so with a method
applemethod() which expects a filename string. I call this method from
main() which is in the file foo.c. Now foo.c and apple.so are in
different directories, and the user calls foo.c with a relative
pathname to the file. My question is how do I make sure that
applemethod knows where this file is from the realtive pathname?
foo.c:
main(int argc, char *argv){
applemethod(argv[1]);
}
apple.c compiled to libapple.so:
voidapplemethod(char *filename){
fp = fopen(filename,"r");
...do stuff...
}
now the user runs ./a.out orange.txt, orange.txt is in the same dir as
foo.c but neither apple.c or libapple.so are in this dir, how does
applemethod know where to look for orange.txt? Does the linker take
care of this automatically? Should I use absolute paths instead?
Any pointers/help would be great.
Let's say I have a dynamic library libapple.so with a method
applemethod() which expects a filename string. I call this method from
main() which is in the file foo.c. Now foo.c and apple.so are in
different directories, and the user calls foo.c with a relative
pathname to the file. My question is how do I make sure that
applemethod knows where this file is from the realtive pathname?
foo.c:
main(int argc, char *argv){
applemethod(argv[1]);
}
apple.c compiled to libapple.so:
voidapplemethod(char *filename){
fp = fopen(filename,"r");
...do stuff...
}
now the user runs ./a.out orange.txt, orange.txt is in the same dir as
foo.c but neither apple.c or libapple.so are in this dir, how does
applemethod know where to look for orange.txt? Does the linker take
care of this automatically? Should I use absolute paths instead?
Any pointers/help would be great.