blabberer

  1. The xxx project - looking under the hoods of guids

    The xxx project - looking under the hoods of guids
    In the olden golden times things were simple and humanely understandable

    Todays machines don't like humans and their understandability

    All they want is garbage to produce more garbage that requires more powerful machine with a higher processing power running multiple cores in parallel and utilizing multi petaabyte memory

    In the olden times we wrote a simple void main (void ) { printf ("hello world \n"); } and all we needed was a 9 MB package that came with almost everything an hobbyist would ever want to write programs with.

    Yes bcc 5.5 command line tools with / includes / libs / resource compilers / make utility / all combined was just a measly 9 MB

    One fine day it went bust and ended up �embarcing� kylie or was it kulfi

    Let it rest in peace in the museum where it may live forever.

    So now comes in express editions of visual studio multi mega byte goliaths that didn�t compile and link but built

    as long as it was a simple hello world build built it and there was no fiddling required and we could live with a 11 MB directory for a simple hello world

    Yes we have to cough up more space than what was required for complete tool-set

    don�t believe me let me dir /s for you one simple hello world

    Code:
     :\>cd
     C:\Documents and Settings\Admin\My Documents\Visual Studio 2010\Projectsweight_of_hello_from_express_to_the_world
    :\>set blah
    blah="f:\SysinternalsSuite\du.exe"
    :\>%blah% -q .
    Files:        61
    Directories:  4
    Size:         11,051,453 bytes
    Size on disk: 11,051,453 bytes
    :\>

    A simple hello world.cpp compiled and linked to hello world.exe needs a 2 GB tool set and 61 intermediate files and obviously 500 GB hard disk get filled with litter in two months flat

    hey bcc 5.5 you didn�t need anything more than a 4 GB hard disk and 128 MB ram machine that was running windows 98 for you to make a tiny little helloworld.exe you are sorely missed.

    Enough nostalgia let�s get on because the history of evolution is that life escapes all barriers. Life breaks free. Life expands to new territories. Painfully, perhaps even dangerously. But life finds a way
    Guru Goldblum
    let�s find a way out of this madness lets break free even if it is painful to become a simple /one cpp /one make file /one compiler and /one linker project and no not using bcc but using visual studio

    It can it did and it will but we have to coax an eighty million year old mosquito embedded in amber to become a Tyrannosaurus Rex

    Lets open the mighty big hello world project and monitor it with process explorer to find clues to its operation

    First clue we get is that once f7 or build is clicked in vcexpress we see msbuild.exe is spawned from vcexpress.exe which calls tracker.exe which calls cl.exe and linker.exe

    Code:
    Command line: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /nologo /nodemode:1 /nr

    Code:
    Command line: "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\Tracker.exe" @"C:\Documents and Settings\Admin\Local Settings\Temp\2855c911ce6c4f5a83da3ea06bb3f4e9.tmp" /c "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\CL.exe"  @"C:\Documents and Settings\Admin\Local Settings\Temp\aee14f5ff66544339403c2d0532a6b68.rsp"

    Code:
    Command line: "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\CL.exe" "@C:\Documents and Settings\Admin\Local Settings\Temp\aee14f5ff66544339403c2d0532a6b68.rsp"

    Code:
    Command line: mspdbsrv.exe -start -spawn

    Code:
    Command line: "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\Tracker.exe" /a @"C:\Documents and Settings\Admin\Local Settings\Temp\0dca85d2d11f41dd86f25cdc7fd79dde.tmp" /c "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\link.exe"  /ERRORREPORT:PROMPT @"C:\Documents and Settings\Admin\Local Settings\Temp\dd9954c18a824badb990e11888b528da.rsp"
    lets check out msbuild whats it is ?

    From process explorer command line we know msbuild is in c:\windows\......\\

    though if you have several .net framework installed each .net version comes with its own msbuild.exe

    Code:
    C:\Program Files\Microsoft Visual Studio 10.0>ndff msbuild.exe
            Total filerecords to scan: 315232
    \WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
    \WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe
    \WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
            Scanned 310259 filerecord(s) in 25.735 s.
            Found 3 file(s), 0 directory(ies), 0 alternate path(s).
    ok it seems this is a command line tool

    Code:
    C:\Program Files\Microsoft Visual Studio 10.0>msbuild /?
    Microsoft (R) Build Engine Version 4.0.30319.1
    [Microsoft .NET Framework, Version 4.0.30319.1]
    Copyright (C) Microsoft Corporation 2007. All rights reserved.
     
    Syntax:              MSBuild.exe [options] [project file]
     
    Description:         Builds the specified targets in the project file. If
                         a project file is not specified, MSBuild searches the
                         current working directory for a file that has a file
                         extension that ends in "proj" and uses that file.

    so it looks for a file with proj extension

    lets check out hello world

    Code:
    :\>dir /s /b *.*proj
    C:\Documents and Settings\Admin\My Documents\Visual Studio 2010\Projects\weight_of_hello_from_express_to_the_world\weight_of_hello_from_express_to_the_world.vcxproj
    :\>
    so there is only one file a .vcxproj

    so as a reverser the first instinct is to cut off all the shit and try only this file

    Code:
    :\>cd C:\Documents and Settings\Admin\Desktop\testvcxproj
    :\>copy "..\..\My Documents\Visual Studio 2010\Projects\ weight_of_hello_from_express_to_the_world\weight_of_hello_from_express_to_the_world.vcxproj".
            1 file(s) copied.
    :\>msbuild
    c1xx : fatal error C1083: Cannot open source file: 'stdafx.cpp':
    Build FAILED.
        1 Error(s)
    Time Elapsed 00:00:00.70

    \> so it is looking for stdafx.cpp providing stdafx.cpp it looks for source.cpp then stdafx.h then targetvar.h lets copy all these 4 files


    :
    Code:
    \>copy "..\..\My Documents\Visual Studio 2010\Projects\weight_of_hello_from_express_to_the_world\stdafx.cpp" .
            1 file(s) copied.    and so on
    :\>dir /s /b
    C:\Documents and Settings\Admin\Desktop\testvcxproj\stdafx.cpp
    C:\Documents and Settings\Admin\Desktop\testvcxproj\stdafx.h
    C:\Documents and Settings\Admin\Desktop\testvcxproj\targetver.h
    C:\Documents and Settings\Admin\Desktop\testvcxproj\weight_of_hello_from_express_to_the_world.cpp
    C:\Documents and Settings\Admin\Desktop\testvcxproj\weight_of_hello_from_express_to_the_world.vcxproj
    :\>msbuild
    Build started 03/04/2014 00:51:57.
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    Time Elapsed 00:00:01.70
    :\>Debug\weight_of_hello_from_express_to_the_world.exe
     h   y  ello  world
     ya    mma
    :\>

    so it worked it seems we don�t want all the file except one vcxproj file to compile link and build we are back to one cpp one make file

    but we see only Debug Folder how to do a Release

    Code:
    :\>msbuild /p:Configuration=Release


    Code:
    :\>Release\weight_of_hello_from_express_to_the_world.exe
      h   y  ello  world
     ya    mma
    so Debug and Release is possible from one proj file

    if we need to clean the directory

    Code:
    /t:Clean /p:Configuration=<config>
    :\>ls -l


    total 24
    drw-rw-rw- 2 Admin 0 0 2014-04-03 00:51 Debug
    drw-rw-rw- 2 Admin 0 0 2014-04-03 00:58 Release
    -rw-rw-rw- 1 Admin 0 328 2014-03-31 00:46 stdafx.cpp
    -rw-rw-rw- 1 Admin 0 320 2014-03-31 00:46 stdafx.h
    -rw-rw-rw- 1 Admin 0 314 2014-03-31 00:46 targetver.h
    -rw-rw-rw- 1 Admin 0 273 2014-03-31 02:48 weight_of_hello_from_express_to_the_
    world.cpp
    -rw-rw-rw- 1 Admin 0 4434 2014-03-31 00:46 weight_of_hello_from_express_to_the_
    world.vcxproj

    now that we have cut away the masks let�s check what�s inside of this project file so that if need arises we can tweak and fiddle with it.


    Opening this is WordPad we find it is written in some kind of markup language called xml

    Some Google reveals xml is kind of html that enforces certain rules that html winks and let goes

    Working with this file in notepad / WordPad is clumsy who want to write < > </>

    Further Google yields an editor from ms xml notepad 2007

    downloading xml notepad 2007 and opening this vcxproject in xml notepad 2007

    We get a nice tree view in the left and text view in the right and handy controls to edit the file with undo redo / font and all other fancy beagles and buttons.



    It is time to start exploring the project file (that is delete everything inside it and start with single line and stop when it seems it works. ...

    Updated April 2nd, 2014 at 19:51 by blabberer

    Categories
    Uncategorized
    Attached Thumbnails Attached Files