Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8348611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:44:39+00:00 2026-06-09T07:44:39+00:00

I am trying to understand the compiling and linking process in C/C++. I know

  • 0

I am trying to understand the compiling and linking process in C/C++. I know that the source files are first converted into object files by the compiler. The linker then generated libraries or executables from the object files.

I am trying to first read the information in object files. Here is the program I have written for experimentation.

func.h

#include <iostream>

void beautifulprint(char *str);

func.cpp

#include "stdafx.h"
#include "func.h"

using namespace std;

void beautifulprint(char *str) {
    cout << "*** " << str << " ***" << endl;
}

TestApp.cpp

#include "stdafx.h"
#include "func.h"

int _tmain(int argc, _TCHAR* argv[])
{
    beautifulprint("Hello, world!");

    return 0;
}

After building the project in VS 2010 I get func.obj. I assumed that somewhere in func.obj there should be a reference for beautifulprint function. I ran the below for both debug and release versions of func.obj

dumpbin /HEADERS func.obj > funchead.txt

Below is the output.

Debug version (Full output not included as it is very large)

...

SECTION HEADER #41
   .text name
       0 physical address
       0 virtual address
      78 size of raw data
    5B94 file pointer to raw data (00005B94 to 00005C0B)
    5C0C file pointer to relocation table
       0 file pointer to line numbers
       A number of relocations
       0 number of line numbers
60501020 flags
         Code
         COMDAT; sym= "void __cdecl beautifulprint(char *)" (?beautifulprint@@YAXPAD@Z)
         16 byte align
         Execute Read

SECTION HEADER #42
.debug$S name
       0 physical address
       0 virtual address
      E8 size of raw data
    5C70 file pointer to raw data (00005C70 to 00005D57)
    5D58 file pointer to relocation table
       0 file pointer to line numbers
       7 number of relocations
       0 number of line numbers
42101040 flags
         Initialized Data
         COMDAT (no symbol)
         Discardable
         1 byte align
         Read Only

...

Release version (Complete output!)

Microsoft (R) COFF/PE Dumper Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file func.obj

File Type: ANONYMOUS OBJECT

ANON OBJECT HEADER VALUES
               1 version
             14C machine (x86)
        50213733 time date stamp Tue Aug 07 16:41:39 2012
                 ClassID: {0CB3FE38-D9A5-4DAB-AC9B-D6B6222653C2}
             2D1 size
               0 flags

And here are my questions. As expected, func.obj Debug version has a reference to beautifulprint. But to my astonishment there is no reference to beautifulprint in Release version? How would the linker know that this function is present in the object file.

Also why does the debug obj version have functions from iostream? Shouldn’t these be present in some standard library instead of this obj?

Edit: I directly opened the release func.obj in VS 2010 in Hex format. I searched for beautifulprint and its present on the right hand side (ASCII) column. It means the reference is present. Why does dumpbin not show it? I need some tool to view it in human readable format.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:44:41+00:00Added an answer on June 9, 2026 at 7:44 am

    Dump the symbols instead. All .obj files have a symbol table. It will show you those symbols defined internally, and those that need resolution. The IO symbols you see may be UNDEF symbols, but the symbol table should make it more clear.

    DUMPBIN /SYMBOLS func.obj
    

    Keep in mind that /SYMBOLS is not available when the object is compiled with /GL (whole program optimization). Object modules created with /GL (as well as libraries) are created with a format that is not guaranteed to be compatible from one compiler version to the next.

    Whole Program Optimization means that the optimizer can optimize across all modules, as opposed to just within each module. Functions can become “inline” and other tricks performed that presumably are not very COFF compatible. It is recommended that deliverable libraries not have the /GL option set unless you are supplying libraries for all supported compiler versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to understand Ruby a bit better, I ran into this code surfing the
I am compiling a project into a .dll and trying to use it in
I am trying to understand which implementation below is faster. Assume that one compiles
I'm trying to understand what Scala does with Case Classes that makes them somehow
I'm trying to use g_rename and compiler gives me strange message error: called object
I'm trying to create a struct used in two .c source files to make
I'm trying to understand how the -pg (or -p ) flag works when compiling
I am trying understand ViewModels deeper and I have read many articles and blogs
Trying to understand what's the correct way of implementing OpenID authentication with Spring Security.
Trying to understand the Deezer API. When I visit: http://connect.deezer.com/oauth/auth.php?app_id=MY_APP_ID&redirect_uri=http://mydomain.me&perms=basic_access I end up at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.