0

I know the switch in gcc but there is nothing about such option in TTC. I read about something _winstart or what swich but I don't know where to put it.

rsk82
  • 28,217
  • 50
  • 150
  • 240
  • It's entirely possible TCC just doesn't support it. At least there's no mention of it in [`tcc-win32.txt`](https://github.com/TinyCC/TinyCC/blob/master/win32/tcc-win32.txt) which seems to be all the documentation for Windows support they have. – millimoose Dec 02 '13 at 04:10
  • I can see that TCC supports it internally, but I can't find any flag that exposes it to you. – icktoofay Dec 02 '13 at 05:10
  • If my memory serves right, pure C windows programs require a non-standard entry point. Some recent discussions on the mailing list seem to shed some light on this: http://lists.nongnu.org/archive/html/tinycc-devel/2013-11/msg00028.html. If that doesn't give you a good starting point, you might consider joining the mailing list and asking there. – David Mertens Dec 03 '13 at 03:11

2 Answers2

2

Ok, it seems it is possible to make non-console app in tcc. I didn't figured out yet what are the key elements necessary here. But in tcc package there is hello_win.c example.

rsk82
  • 28,217
  • 50
  • 150
  • 240
0

tcc -Wall -Wl,-subsystem=windows example.c -luser32

gives no console window pop-up. See tcc -hh

example.c:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

// need -luser32 at end of tcc cmd line. user presses OK returns 1.

int main(int argc, char *argv[]) {
    char *banner = malloc(100);
    sprintf(banner, "tcc is great, %d cmd line or DRAGGED args", argc - 1);
    while (argc-- > 0) MessageBox(NULL, argv[argc], banner, 1 + 256);
    return(0);
}

To add an icon in file example.ico (generated by irfanview for example) to the executable, use cygwin util windres, create a file example.rc:

this ICON example.ico

then

windres example.rc -O coff -o example.res

and use

tcc -Wall -Wl,-subsystem=windows example.c -luser32 example.res

By the way, I'm using tcc from http://repo.or.cz/tinycc.git, and to compile this version of tcc under cygwin:

./configure --tccdir=/usr/tcc --bindir=/usr/bin
make
make install

BTW2: anyone figure out how to pass more args to these c programs under windows? There is some windows limit. With 1000 args dragged, get 'The filename or extension is too long'. The limit is on the windows side. Windows and commercial programs do not have this limit.

John Refling