?
Solved

Linkage flag difference questions

Posted on 2010-09-01
14
Medium Priority
?
394 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 

Author Comment

by:HPBSM
ID: 33576121
Of course these are c++ projects.
Thanks
0
 
LVL 86

Expert Comment

by:jkr
ID: 33576355
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
ID: 33576461
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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 86

Expert Comment

by:jkr
ID: 33576709
>>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
ID: 33578492
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
ID: 33578730
>>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
ID: 33578886
But how the code of httpencoder.lib takes affect at run time in transdata.dll?
0
 
LVL 86

Expert Comment

by:jkr
ID: 33579121
'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
ID: 33595438
jkr:

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

Expert Comment

by:jkr
ID: 33596990
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
ID: 33606822
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
ID: 33607094
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
ID: 33615855
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 2000 total points
ID: 33620990
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 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

777 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