Linkage flag difference questions

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
HPBSMAsked:
Who is Participating?
 
jkrCommented:
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
 
HPBSMAuthor Commented:
Of course these are c++ projects.
Thanks
0
 
jkrCommented:
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
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
HPBSMAuthor Commented:
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
 
jkrCommented:
>>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
 
HPBSMAuthor Commented:
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
 
jkrCommented:
>>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
 
HPBSMAuthor Commented:
But how the code of httpencoder.lib takes affect at run time in transdata.dll?
0
 
jkrCommented:
'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
 
HPBSMAuthor Commented:
jkr:

Does it mean that httpencoder.lib is a static library or no?
0
 
jkrCommented:
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
 
HPBSMAuthor Commented:
jkr:

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

Thanks!
0
 
jkrCommented:
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
 
HPBSMAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.