Creating Tiny Windows executables with TCC

I recently compiled a small executable program writtern in C with the Visual Studio C++ Express. The output was a 56K executable, which ok is pretty small, but actually in terms of programs its really large.

So I looked into compiling my program with the TinyCC compiler.

First I downloaded the compiler, however it quickly came apparent that the libraries and includes that come with the compiler were just a minimal set. What I needed was the includes from MinGW. Its only necceccery to download the Windows 32 API package.

My program needed to be linked with winsock2 so first i needed to run

tiny_impdef c:windowssystem32ws2_32.dll

This will generate a ws2_32.def file. I was then able to simply compile the program with.


tcc program.c ws2_32.def

The output of which is an executable of 1K. I asume because the compiler itself is small, and the compiler compiles itself that it would produce rather small executables. I have yet to test compiling the same program using mingw and GCC -Os.

Advertisement

Rock Concert

Joey and I went to see Nickleback live at Sheffield Arena. We went with Chris, Trish, and Alex.

Set List

  • Animals
  • Woke Up This Morning
  • Photograph
  • Because of You
  • Far Away
  • Saturday Night’s Alight (For Fighting)
  • (Elton John cover)
  • If Everyone Cared
  • Savin’ Me
  • Someday
  • Side of a Bullet
  • How You Remind Me
  • Too Bad

Encore:

  • Rockstar

Conversation with my Dad about "T'Internet"

Dad: “How do I turn off your Internet.”
Giles: “Its a router, you just leave it connected.” (He has an ADSL modem)
Dad: “But how do I close the website down so that its not connected to that website, I don’t want to hog that website.”
Giles: “HTTP is stateless meaning that the website is no longer connected as soon as you have finished loading the page.”
Dad: “Well with some websites you have to log off, like Banks, and they have a lot of problems when too many people are logged in.”
Giles: “The problems that Banks have are very specific to their applications, which is why for example you can’t press the back button on Barclays, because banks try to have stateful sessions built on top of HTTP which is stateless, but the rest of the web works the way I just said.”
Dad: “oh”

Later on my “Technophobic” Dad beat us all at Wii Bowling.

Finding aspnet_regiis.exe

Yet again I am searching the net for aspnet_regiis. I tried various combinations including asp_iisreg and aspiis_reg, both of which return results in google. so it seems that I am not the only one who keeps forgetting how it is called. I decided to put it here for my own personal reference. This tool usually has to be run using the -i parameter if you install IIS after you installed Visual Studio and you want to do web service type things.

Sidechain Reverb

Sidechain compression is not the only effect you can create in Reason using the MClass compressor. Those smart people at propellerheads were insigtful enough to give the MClass compressor a Gain Reduction CV out. Which you can use to control any parameter you like.


Here I am using the compressor to pump an RV7000 Reverb Start by creating a Combinator to host the RV7000 this allows you control parameters that would not otherwise be controllable using CV’s. I’ve put the compressor in the combinator too just to keep things tidy. The Gain Reduction CV output is connected to the Rotarty 1 input on the Combinator. This allows Rotary 1 to be routed to the Dry/Wet parameter of the RV7000.

The overall effect of this setup isn’t that great, but the point is that you can use sidechaining to control any parameter in Reason.

iMindMap

iMindMap Example
I am trying out Tony Buzan’s iMindMap I wanted a piece of software that could capture my thoughts quickly. Mind Maps seem like the best solution for this. iMindMap produces excellent mind maps very quickly, but the best thing is that the maps are visually appealling. This is good for presentations but also helps you to remember things if they are organic and colorful.

Mplayer on Tom Tom

I am now trying to run Mplayer on Tom Tom so that I can watch videos and drive anyone reading this to drink. I found however that Mplayer requires a lot of system resources that are being used by the Navigation application (ttn) So I needed a way to free up the memory and resources being used by the application. This should be as simple as just killing the application using

killall ttn

But the problem is that the ttn application is responsible for petting the dog. That is to say that there is a WatchDog Timer which resets the device after 15 seconds unless something continuously resets the timer.
All that was needed was a script to reset the timer instead, So here is my solution:

#!/bin/sh
killall ttn &&
while(true) do
echo '' > /dev/watchdog
sleep 10
done

The trick is to kill the ttn but also keep the Watchdog from reseting the device. The script also has to be invoked as a background job, so I used an ‘&’ after the command.

./free.sh &