Solved

Linkage flag difference questions

Posted on 2010-09-01
14
379 Views
Last Modified: 2012-05-10
Hi,

I have a 1st linkage of a project with the link parameters appear in the attached file nm133.txt and a 2nd
linkage of a project with the link parameters appear in the attached file nm133.txt.
In both there is a use of a makefile.
The question: Is there any difference between the artifact of the 1st linkage httpsender.lib to the artifact of the 2st linkage httpencoder.lib?

Thanks!
nm133.txt
nm139.txt
0
Comment
Question by:HPBSM
  • 7
  • 7
14 Comments
 

Author Comment

by:HPBSM
Comment Utility
Of course these are c++ projects.
Thanks
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
Well, the 1st one uses '/DEBUGTYPE', yet that flag is ignored if '/DEBUG' isn't explicitly specified. So, apart from the various input files, the major diference is that the 1st is linked as a DLL, the second one as a GUI application.
0
 

Author Comment

by:HPBSM
Comment Utility
As a matter of fact the 1st one creates a dll and a lib and the 2nd one creates a lib and my question is if there is a difference between these libs? Is the lib created by the 2nd one is a static library? How actually the code affects in run time in the 2nd? In the client code compiles with the lib and in run time it loads the dll, but what happens in the lib created in the 2nd one? There is no dll created there...
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
>>Is the lib created by the 2nd one is a static library?

If 'lib.exe' is tun after 'link', yes. If that the case, the code (if it's the same) will only be affected at runtime in the way that it is not loaded from the DLL, but from the executable that is linked with the static library the code resides in. In that case, the code in question is 'copied' to the executable when it is built.
0
 

Author Comment

by:HPBSM
Comment Utility
Hi,

This is the order of build: link.exe is activate. The artifact is transdata.dll. So httpencoder.lib is a static library?

Thanks.

1>Creating dll...
1> C:\progra~1\MID05A~1\VC\bin\link @C:\DOCUME~1\levy\LOCALS~1\Temp\nm274.tmp
1>Microsoft (R) Incremental Linker Version 8.00.50727.42
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>-machine:i386
1>-subsystem:windows
1>-debugtype:cv /DEBUG
1>-dll
1>-entry:_DllMainCRTStartup@12
1>/out:..\obj\transdata.dll
1>/implib:..\obj\transdata.lib
1>..\obj\transdata_ext.obj
1>..\obj\ts_sample_ctor.obj
1>..\obj\ts_sample_ctor_for_http_comm.obj
1>..\obj\ts_sample_ctor_for_samples_comm.obj
1>..\obj\ts_repot_data_ctor.obj
1>..\obj\ts_samples_to_http_conv.obj
1>..\obj\soa_ts_repot_data_ctor.obj
1>..\obj\soa_ts_sample_ctor_for_http_comm.obj
1>..\obj\soa_ts_sample_ctor_for_samples_comm.obj
1>std-vc-mt.lib
1>wrapicu.lib
1>mosifs32.lib
1>miclogger.lib
1>breakdown.lib
1>libxdrutil.lib
1>thrdutil.lib
1>httpencoder.lib
1>ws2_32.lib
1>libcurl_imp.lib
1>data_types_ifs.lib
1>protodata.lib
1>mictime.lib
1>oldnames.lib
1>kernel32.lib
1>advapi32.lib
1>user32.lib
1>gdi32.lib
1>comdlg32.lib
1>shell32.lib
1>winspool.lib
1>default.res
1>LINK : ..\obj\transdata.dll not found or not built by the last incremental link; performing full link
1>   Creating library ..\obj\transdata.lib and object ..\obj\transdata.exp
1>httpencoder.lib(http_encoder.obj) : warning LNK4099: PDB 'vc80.pdb' was not found with 'C:\Workspaces\tp26_agent_data\sccs\arch\httpencoder.lib' or at 'c:\Workspaces\tp26_agent_data\sccs\app\transdata\obj\vc80.pdb'; linking object as if no debug info
1> if exist ..\obj\transdata.dll.manifest C:\progra~1\MID05A~1\VC\bin\mt -manifest ..\obj\transdata.dll.manifest -outputresource:..\obj\transdata.dll;2
1>Microsoft (R) Manifest Tool version 5.2.3790.2014
1>Copyright (c) Microsoft Corporation 2005.
1>All rights reserved.
1>done!!
1>lib done
1>system done
1> copy ..\obj\transdata.lib C:\Workspaces\tp26_agent_data\sccs\arch
1>        1 file(s) copied.
1> copy ..\obj\transdata.dll C:\Workspaces\tp26_agent_data\sccs\arch
1>        1 file(s) copied.
1> copy ..\obj\transdata.pdb C:\Workspaces\tp26_agent_data\sccs\arch
1>        1 file(s) copied.
1>install done
1>Build log was saved at "file://c:\Workspaces\tp26_agent_data\sccs\app\transdata\src\Interface Compile Install\BuildLog.htm"
1>transdata - 0 error(s), 2 warning(s)

0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
>>So httpencoder.lib is a static library?

No, this creates a DLL called 'transdata.dll' and an import library with the corresponding name (transdata.lib) as indicated by these lines:

1>-dll
1>-entry:_DllMainCRTStartup@12
1>/out:..\obj\transdata.dll
1>/implib:..\obj\transdata.lib

/DLL Builds a DLL (http://msdn.microsoft.com/en-us/library/527z7zfs.aspx)
/OUT Specifies the output file name (http://msdn.microsoft.com/en-us/library/8htcy933.aspx)
/IMPLIB Overrides the default import library name (http://msdn.microsoft.com/en-us/library/67wc07b9.aspx)

See also http://msdn.microsoft.com/en-us/library/y0zzbyt4%28v=VS.100%29.aspx ("Linker Options")
0
 

Author Comment

by:HPBSM
Comment Utility
But how the code of httpencoder.lib takes affect at run time in transdata.dll?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 86

Expert Comment

by:jkr
Comment Utility
'httpencoder.lib' is just one if the inout files in the above link process, i.e. line 28:

1>httpencoder.lib

This means thar the code that transdata.dll uses in httpencoder.lib is copied and placed in transdata.dll during this run.
0
 

Author Comment

by:HPBSM
Comment Utility
jkr:

Does it mean that httpencoder.lib is a static library or no?
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
Well, it does - if it was an import library for a DLL, no code would be copied, just the additional dependency to the related DLL would be added.
0
 

Author Comment

by:HPBSM
Comment Utility
jkr:

O.K. I think I need some more explanation about your last sentence: Can you please explain it a bit more?

Thanks!
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
OK: In case of a satatic library, the code referenced by the target project is copied into that target during the link process. In case of a dynamic library, just a reference to that dynamic library is placed target project (i.e. name of the DLL and entry point addresses of the functions).
0
 

Author Comment

by:HPBSM
Comment Utility
Is there any way to identify that a library is a static one according to the compilation flags, in another words that it creates only a .lib file and not a dll?

Thanks
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
Comment Utility
You mean when building it or when using it? In the 1st case, there will be a '/DLL' switch in the linker options, in the latter, you can use 'lib' or 'dumpbin' to check whether the library contains any actual code.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Clone HDD in RAID1 10 109
convert char array to number in c 5 77
Windows 7 and Pro update issues 5 75
Exchange & AD management console 2 43
We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now