I have few libraries of someone else's products, and few my libraries (dlls and headers). And for good structuring of my project (and just for increase my knowledge), I want to place dlls in others directories (not dir with exe).
As far as I know, Windows uses dlls (looking dlls for exe) only in exedir and sysdir. Also, exist regkeys which can help me, but it's global solution as PATH var.
1. Can I link exe with some dll, which placed in dir on lower hierarchy about exe? How?
Also, I want to use for this MinGW.
I found not enough information about my question, and I found this g++ keys for linker: -Wl,-rpath-link,...; -Wl,-rpath,...
;
2. Can I use this keys to solve my problem on Windows with MinGW? How?
I tried this: g++ -Wl,-rpath-link,.\out\lib\ -Wl,-rpath,.\lib\ -L .\out\lib\ -l:foolib.dll main.o -o out\main.exe
but I still can run exe without errors only if dlls placed in exedir.
So, I found arg(?) $ORIGIN
for -Wl,-rpath,...
which as I understand, is fullpath to workdir for some obj file? Or not?
3. What is $ORIGIN? Should\Can I use it to solve my problem?
Sorry for my English. Thank you in advance.