Author Topic: Visual C++ 4k settings?  (Read 11063 times)

0 Members and 1 Guest are viewing this topic.

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Visual C++ 4k settings?
« on: November 13, 2006 »
Does anyone (Rbraz?) have a set of instriuctions/settings/steps/tutorial/link on how to reduce code size to the minimum using Visual C++. I prefer to put as little into the C code as possible. I usually use GCC but I'm having a lot of issues combining that with DX and these days DX offers a lot more than Opengl for size coders.

Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Visual C++ 4k settings?
« Reply #1 on: November 13, 2006 »
Sorry ... I am in a hurry ... but maybe this link is of some help for you :

http://keyj.s2000.ws/?p=29

cu l8er.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: Visual C++ 4k settings?
« Reply #2 on: November 13, 2006 »
I'm installing Visual C++ 2005 Express right now, when I got something I'll post here...
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Visual C++ 4k settings?
« Reply #3 on: November 13, 2006 »
Sorry ... I am in a hurry ... but maybe this link is of some help for you :

http://keyj.s2000.ws/?p=29

cu l8er.

That link has one or two gems including the /QIfist hint! Thanks Benny
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: Visual C++ 4k settings?
« Reply #4 on: November 14, 2006 »
With VC2005 Express, the best what I can get is 563 bytes packed...
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: Visual C++ 4k settings?
« Reply #5 on: November 14, 2006 »
Ok, now it's 427 bytes only  :o , damn it's too close to my ASM version (421 bytes packed)   :||


 :cheers:



[Edited - file updated again...]
« Last Edit: November 19, 2006 by Rbraz »
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Visual C++ 4k settings?
« Reply #6 on: November 14, 2006 »
Now thats worth Karma :-) thanks rbraz!
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Visual C++ 4k settings?
« Reply #7 on: November 14, 2006 »
Indeed .. very cool Rbraz. Thx for sharing !
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: Visual C++ 4k settings?
« Reply #8 on: November 15, 2006 »
No problems dudes :)

I have updated the attached file, just removed unused #pragma commands, removed msvcrt.lib and added msvcrtd.lib instead.
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Visual C++ 4k settings?
« Reply #9 on: November 15, 2006 »
@rbraz:

cool ...


@taj:

uhh ... the new banner looks scary cool  ;)
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Visual C++ 4k settings?
« Reply #10 on: November 15, 2006 »
Ok, now it's 427 bytes only  :o , damn it's too close to my ASM version (421 bytes packed)   :||
 :cheers:

[Edited - file updated...]

Rbraz,

I did some texting with this with some results for you.
Aulds 1k framework under GCC, your exact version of code: 494 bytes
Aulds 1k framework under GCC, his code: 474 bytes

Neither is close to your result but 50 bytes is damn suspicious. Thats something not working (as if aulds framework pulls in another library under GCC), not simple optimisation. Nontheless it seems VC++ plus your tuned version of aulds framework is 50 bytes smaller!! Damn, guess I'll be working in VC++ from now on.

One thing how do you compress? Is it convert to com and then use apack?
Are you using the same settings as in aulds framework or something else?
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: Visual C++ 4k settings?
« Reply #11 on: November 15, 2006 »
Cool, I hope that Auld can find this and post it at In4k  ;)

To compress it, I just used the same settings as Auld have used for his framework, tried others settings but without any better results...

Cheers,
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Visual C++ 4k settings?
« Reply #12 on: November 15, 2006 »
In4k is a wiki Rbraz, you can always add this information yourself...
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: Visual C++ 4k settings?
« Reply #13 on: November 15, 2006 »
I've already registered at In4k (sometime ago), I'll check how to add that info there... thx
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: Visual C++ 4k settings?
« Reply #14 on: November 15, 2006 »
In4k is a wiki Rbraz, you can always add this information yourself...

Done  ;)
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Visual C++ 4k settings?
« Reply #15 on: November 15, 2006 »
In4k is a wiki Rbraz, you can always add this information yourself...

Done  ;)

Yeah checked it out, mega cool!
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Visual C++ 4k settings?
« Reply #16 on: November 18, 2006 »
Im really struggling to get this working Rbraz.

Installed VC++ 2005 Express
Installed platform SDK

trying to manually find all the paths for stuff that it needs..getting this error
Project : error PRJ0002 : Error result -1073741515 returned from 'C:\Program Files\Microsoft Visual Studio 8\VC\bin\link.exe'.

Any ideas?


...

Ok found the answer. Despite the install instructions I found I had to add:
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
under Tools->Options->Projects and Solutions->VC++ Files on the tab executable Files

As you can imagine, it took a while to find so if anyone else tries this and has issues, I wanted to write it down to save you hassle.
« Last Edit: November 18, 2006 by taj »
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Visual C++ 4k settings?
« Reply #17 on: November 18, 2006 »
Rbraz,

why have you added exitprocess and return 0 to the code? It seems to compile and run fine without them and the result is only 414 bytes.
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Visual C++ 4k settings?
« Reply #18 on: November 18, 2006 »
...
Ok found the answer. Despite the install instructions I found I had to add:
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
under Tools->Options->Projects and Solutions->VC++ Files on the tab executable Files

As you can imagine, it took a while to find so if anyone else tries this and has issues, I wanted to write it down to save you hassle.

Always nice to see when people add the solution to their own question when no one else
answerrs ! I like this attitude - keep it up. (Karma up!)
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: Visual C++ 4k settings?
« Reply #19 on: November 19, 2006 »
Im really struggling to get this working Rbraz.

Installed VC++ 2005 Express
Installed platform SDK

trying to manually find all the paths for stuff that it needs..getting this error
Project : error PRJ0002 : Error result -1073741515 returned from 'C:\Program Files\Microsoft Visual Studio 8\VC\bin\link.exe'.

Any ideas?


...

Ok found the answer. Despite the install instructions I found I had to add:
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
under Tools->Options->Projects and Solutions->VC++ Files on the tab executable Files

As you can imagine, it took a while to find so if anyone else tries this and has issues, I wanted to write it down to save you hassle.

I really recommend for people who want install VC++2005 to follow this link, step by step, to avoid such problems:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/


Rbraz,

why have you added exitprocess and return 0 to the code? It seems to compile and run fine without them and the result is only 414 bytes.

Because I like to waste bytes  ::)
No, just kidding, because I'm not able to make WinMain return void, and since that function return int,  return 0 doesn't make your file bigger.

About Exitprocess(0), you know better than me that is more safe to exit all process created by our prog, if removed from my ASM version, the final file is 399 bytes, but it crash when exit was pressed...



Well, I found one issue about VC++2005 framework, msvcrt.lib and msvcrtd.lib they call respectively those dlls - msvcrt80.dll and msvcrt80d.dll
to get rid about that I've included an old msvcrt.lib (from VC++6.0) and renamed it to msvcrts.lib ( s=standard), this library call the standard msvcrt.dll present in all windows platform (I guess), anyway I've tested it with Windows98 and WinXP and it works fine.

Download the updated framework here --> http://www.rbraz.com/source/1K_FrameWork_VC2005.zip
There's a little readme.txt file included to help you install the file msvcrts.lib

Have fun!

Challenge Trophies Won: