tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Building Unicode applications with TCC in Windows.


From: Carlos Montiers
Subject: Re: [Tinycc-devel] Building Unicode applications with TCC in Windows.
Date: Sat, 5 Jul 2014 16:12:27 -0400

Look these code adapted from my current develop of bg tool ( http://consolesoft.com/p/bg ):

#define UNICODE

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>

#undef		putchar
#undef 		putwchar
#undef		isxdigit
#undef		iswxdigit
#define		putchar(c)		fputc(c, stdout)
#define		putwchar(c)		fputwc(c, stdout)
#define		isxdigit(d)		_isctype(d, _HEX)
#define		iswxdigit(d)	iswctype(d, _HEX)

#ifdef UNICODE
#define 	strtoul 			wcstoul
#define 	_strupr 			_wcsupr
#define 	strcmp 				wcscmp
#define 	atol 				_wtol
#define		_isctype			iswctype
#define		fputc				fputwc
#define		ReadConsoleInput	ReadConsoleInputW
#define		PlaySound			PlaySoundW
#else
#define		ReadConsoleInput	ReadConsoleInputA
#define		PlaySound			PlaySoundA
#endif



typedef struct {
    int newmode;
} _startupinfo;

void __wgetmainargs(int *_Argc, wchar_t *** _Argv, wchar_t *** _Env,
		    int _DoWildCard, _startupinfo * _StartInfo);
void __getmainargs(int *_Argc, char ***_Argv, char ***_Env,
		   int _DoWildCard, _startupinfo * _StartInfo);

int my_main(int argc, TCHAR* argv[]);


void _start(void)
{
int argc; TCHAR **argv; TCHAR **env; int ret;

 _startupinfo start_info = { 0 }; #ifdef UNICODE __wgetmainargs(&argc, &argv, &env, 0, &start_info); #else __getmainargs(&argc, &argv, &env, 0, &start_info); #endif ret = my_main(argc, argv); exit(ret); }

int my_main(int argc, TCHAR* argv[])
{
    return 0;
}

for printf:
these:
printf("Hello %s\n", argv[0]);
using unicode you need use replace with this:
wprintf(L"Hello %ls\n", argv[0]);







2014-07-05 9:23 GMT-04:00 James Russell Moore <address@hidden>:
Hello, I have a small utility which makes use of wide characters in Windows. It's written using _TCHAR though so it can be built with multibyte characters as well.

The main() function header is written as follows:

int _tmain(int argc, _TCHAR* argv[])

Translates to "main" in a multibyte build and "wmain" in a Unicode build, but TCC seems to expect a main() function instead of a wmain() one so it can't produce Unicode builds (I tried with a mob build as well).

Is is expected or is there something wrong? Would it be possible to make a modification to enable wmain() to be an entry point as well as main()?

Attached to this email is a small test case.

Thanks for your time anyway.

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]