User forums > Using Code::Blocks
C::B linker option generation issue
ollydbg:
Hi, when I put a lib name "libcv210.dll.a" in the linker options, I see it generate such command line: "-lcv210.dll"
--- Quote ----------------- Build: Debug in jjjjj (compiler: GNU GCC Compiler)---------------
[ 50.0%] g++.exe -g -IE:\code\opencv\opencv210_mingw\include -c E:\project\freescale_image_process\jjjjj\main.cpp -o obj\Debug\main.o
[100.0%] g++.exe -LE:\code\opencv\opencv210_mingw\lib -LE:\code\opencv\opencv210_mingw\bin -o bin\Debug\jjjjj.exe obj\Debug\main.o -lcv210.dll -lcxcore210.dll -lhighgui210.dll
Output file is bin\Debug\jjjjj.exe with size 443.63 KB
Process terminated with status 0 (0 minute(s), 3 second(s))
0 error(s), 0 warning(s) (0 minute(s), 3 second(s))
--- End quote ---
But from what I see in MinGW/GCC document:
--- Quote ---For instance, when ld is called with the argument -lxxx it will attempt to find, in the first directory of its search path,
libxxx.dll.a
xxx.dll.a
libxxx.a
cygxxx.dll (*)
libxxx.dll
xxx.dll
before moving on to the next directory in the search path.
--- End quote ---
I think the command line should be "-lcv210".
Any ideas?
MortenMacFly:
--- Quote from: ollydbg on April 24, 2013, 03:22:11 pm ---I think the command line should be "-lcv210".
Any ideas?
--- End quote ---
How would you differ between libfoo.dll.a (dynamic import lib) and libfoo.a (static lib) then? I think this is correct.
Also remember that a lot of libs are like libcom.foo.bar.a these days...
ollydbg:
--- Quote from: MortenMacFly on April 24, 2013, 03:50:59 pm ---
--- Quote from: ollydbg on April 24, 2013, 03:22:11 pm ---I think the command line should be "-lcv210".
Any ideas?
--- End quote ---
How would you differ between libfoo.dll.a (dynamic import lib) and libfoo.a (static lib) then? I think this is correct.
--- End quote ---
I think it is simple, if a library name (libfoo.dll.a) have such format: have prefix "lib" and suffix "dll.a", then we should use the -lfoo.
--- Quote ---Also remember that a lot of libs are like libcom.foo.bar.a these days...
--- End quote ---
In these cases, It simply should be: -lcom.foo.bar , as it does not have a suffix "dll.a". ;D
MortenMacFly:
--- Quote from: ollydbg on April 24, 2013, 03:55:19 pm ---I think it is simple, if a library name have the format: have prefix with "lib" and suffix with "dll.a", then we should use the -lfoo.
--- End quote ---
Maybe I am missing something... but...
Assume you have both of these libs in one folder (which is often the case). You would be unable to address the ".dll" import lib if you remove the DLL automagically. The linker would always pick the static lib.
ollydbg:
--- Quote from: MortenMacFly on April 24, 2013, 04:39:24 pm ---Assume you have both of these libs in one folder (which is often the case). You would be unable to address the ".dll" import lib if you remove the DLL automagically. The linker would always pick the static lib.
--- End quote ---
Ok, Let me explain:
If I have both two libraries libfoo.dll.a (dynamic import library) and libfoo.a(static library) in the same folder.
Then, if user put "libfoo.dll.a" in the C::B linker library input control, then it generate "-lfoo.dll" command, the ld/gcc pick "libfoo.dll.a" as the third rule below, here "xxx" = "foo.dll"
--- Quote ---libxxx.dll.a
xxx.dll.a
libxxx.a
cygxxx.dll (*)
libxxx.dll
xxx.dll
--- End quote ---
If the user put "libfoo.a" in the C::B library input control, it generate "-lfoo", and follow the rule, it pick "libfoo.dll.a" as it is the first rule, here here "xxx" = "foo", But in this case, the user just want to link to static library?
Navigation
[0] Message Index
[#] Next page
Go to full version