.lib mystery and headache [modified]
-
the command line of linker in project-property contains:kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib however it doesn't contain "boost_regex-vc80-mt-1_37.lib" which I used to use boost_regex-vc80-mt-1_37.dll and the latter one contains regex_search() function and so on. And I find I can use regex_search,smatch in My Application soomthly. All I do in my source code is including Two head files. I am wondering how does the complier locate "boost_regex-vc80-mt-1_37.lib"? I know there is only symbols(variable names,function names, etc)in .lib, even the complier gain the .lib, how the linker gain the corespondent .dll's name. Can somebody tell me? Thanks a lot.
modified on Friday, March 6, 2009 3:08 PM
-
the command line of linker in project-property contains:kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib however it doesn't contain "boost_regex-vc80-mt-1_37.lib" which I used to use boost_regex-vc80-mt-1_37.dll and the latter one contains regex_search() function and so on. And I find I can use regex_search,smatch in My Application soomthly. All I do in my source code is including Two head files. I am wondering how does the complier locate "boost_regex-vc80-mt-1_37.lib"? I know there is only symbols(variable names,function names, etc)in .lib, even the complier gain the .lib, how the linker gain the corespondent .dll's name. Can somebody tell me? Thanks a lot.
modified on Friday, March 6, 2009 3:08 PM
-
the command line of linker in project-property contains:kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib however it doesn't contain "boost_regex-vc80-mt-1_37.lib" which I used to use boost_regex-vc80-mt-1_37.dll and the latter one contains regex_search() function and so on. And I find I can use regex_search,smatch in My Application soomthly. All I do in my source code is including Two head files. I am wondering how does the complier locate "boost_regex-vc80-mt-1_37.lib"? I know there is only symbols(variable names,function names, etc)in .lib, even the complier gain the .lib, how the linker gain the corespondent .dll's name. Can somebody tell me? Thanks a lot.
modified on Friday, March 6, 2009 3:08 PM
In the linker option, you need to give the path of your boost lib. Open your project properties dialog,
Config&properties->Linker->General Options->AddtitionalLibrarayDirectories[//Give the path of your libs here]
Then in Input option,
Likner->Input->AdditionalDependencies[// Here specify your boos lib] //Also you can give absolute paths here.
Alternatively, In your code you can use
#pragma comment(lib,"Absolute_path_to_your_lib")
JackPuppy wrote:
I know there is only symbols(variable names,function names, etc)in .lib, even the complier gain the .lib, how the linker gain the corespondent .dll's name.
Good question, but unfortunately the lib doesn't tell you about location details of your DLL. The lib just contains the exported symbols of the dll. It just talks about it. So when compiling you don't need the dll. Just a lib reference is enough. But at run time, you need to keep your dll along with your .exe or in system folders.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
-
In the linker option, you need to give the path of your boost lib. Open your project properties dialog,
Config&properties->Linker->General Options->AddtitionalLibrarayDirectories[//Give the path of your libs here]
Then in Input option,
Likner->Input->AdditionalDependencies[// Here specify your boos lib] //Also you can give absolute paths here.
Alternatively, In your code you can use
#pragma comment(lib,"Absolute_path_to_your_lib")
JackPuppy wrote:
I know there is only symbols(variable names,function names, etc)in .lib, even the complier gain the .lib, how the linker gain the corespondent .dll's name.
Good question, but unfortunately the lib doesn't tell you about location details of your DLL. The lib just contains the exported symbols of the dll. It just talks about it. So when compiling you don't need the dll. Just a lib reference is enough. But at run time, you need to keep your dll along with your .exe or in system folders.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
thanks pal! however I didn't "Likner->Input->AdditionalDependencies[// Here specify your boos lib] //Also you can give absolute paths here", neither "#pragma comment(lib,"Absolute_path_to_your_lib". But I can use regex_search(), and why? it's confusing?(I did include the lib's directory in project property dialog). Further the lib seems to contain at least the name of the dll, however see this lib codes I have dumpbin from a lib:
Microsoft (R) COFF/PE Dumper Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.Dump of file E:Visual Studio 2005\Projects\DLLexperiment\debug\dllshiyan.lib
File Type: LIBRARY
Archive member name at 8: /
49B21595 time/date Sat Mar 07 14:35:01 2009
uid
gid
0 mode
7A size
correct header end5 public symbols 17E \_\_IMPORT\_DESCRIPTOR\_dllshiyan 3B0 \_\_NULL\_IMPORT\_DESCRIPTOR 4EA dllshiyan\_NULL\_THUNK\_DATA 642 \_\_imp\_\_add 642 \_add
Archive member name at BE: /
49B21595 time/date Sat Mar 07 14:35:01 2009
uid
gid
0 mode
84 size
correct header end4 offsets 1 17E 2 3B0 3 4EA 4 642 5 public symbols 1 \_\_IMPORT\_DESCRIPTOR\_dllshiyan 2 \_\_NULL\_IMPORT\_DESCRIPTOR 4 \_\_imp\_\_add 4 \_add 3 dllshiyan\_NULL\_THUNK\_DATA
Archive member name at 17E: dllshiyan.dll/
49B21595 time/date Sat Mar 07 14:35:01 2009
uid
gid
0 mode
1F6 size
correct header endFILE HEADER VALUES
14C machine (x86)
3 number of sections
49B21595 time date stamp Sat Mar 07 14:35:01 2009
110 file pointer to symbol table
8 number of symbols
0 size of optional header
100 characteristics
32 bit word machineSECTION HEADER #1
.debug$S name
0 physical address
0 virtual address
44 size of raw data
8C file pointer to raw data (0000008C to 000000CF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42100040 flags
Initialized Data
Discardable
1 byte align
Read OnlySECTION HEADER #2
.idata$2 name
0 physical address
0 virtual address
14 size of raw data
D0 file pointer to raw -
thanks pal! however I didn't "Likner->Input->AdditionalDependencies[// Here specify your boos lib] //Also you can give absolute paths here", neither "#pragma comment(lib,"Absolute_path_to_your_lib". But I can use regex_search(), and why? it's confusing?(I did include the lib's directory in project property dialog). Further the lib seems to contain at least the name of the dll, however see this lib codes I have dumpbin from a lib:
Microsoft (R) COFF/PE Dumper Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.Dump of file E:Visual Studio 2005\Projects\DLLexperiment\debug\dllshiyan.lib
File Type: LIBRARY
Archive member name at 8: /
49B21595 time/date Sat Mar 07 14:35:01 2009
uid
gid
0 mode
7A size
correct header end5 public symbols 17E \_\_IMPORT\_DESCRIPTOR\_dllshiyan 3B0 \_\_NULL\_IMPORT\_DESCRIPTOR 4EA dllshiyan\_NULL\_THUNK\_DATA 642 \_\_imp\_\_add 642 \_add
Archive member name at BE: /
49B21595 time/date Sat Mar 07 14:35:01 2009
uid
gid
0 mode
84 size
correct header end4 offsets 1 17E 2 3B0 3 4EA 4 642 5 public symbols 1 \_\_IMPORT\_DESCRIPTOR\_dllshiyan 2 \_\_NULL\_IMPORT\_DESCRIPTOR 4 \_\_imp\_\_add 4 \_add 3 dllshiyan\_NULL\_THUNK\_DATA
Archive member name at 17E: dllshiyan.dll/
49B21595 time/date Sat Mar 07 14:35:01 2009
uid
gid
0 mode
1F6 size
correct header endFILE HEADER VALUES
14C machine (x86)
3 number of sections
49B21595 time date stamp Sat Mar 07 14:35:01 2009
110 file pointer to symbol table
8 number of symbols
0 size of optional header
100 characteristics
32 bit word machineSECTION HEADER #1
.debug$S name
0 physical address
0 virtual address
44 size of raw data
8C file pointer to raw data (0000008C to 000000CF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42100040 flags
Initialized Data
Discardable
1 byte align
Read OnlySECTION HEADER #2
.idata$2 name
0 physical address
0 virtual address
14 size of raw data
D0 file pointer to raw -
there isn't(or I couldn't find it out)plus,this is really very confused reading, can you give me some acrtiles on what each sentence in this lib mean? thanks!