[Top][All Lists]

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

Re: [Tinycc-devel] Undefined symbols

From: Jared Maddox
Subject: Re: [Tinycc-devel] Undefined symbols
Date: Sun, 21 Jul 2013 19:36:39 -0500

20.07.2013 5:37, address@hidden ?????:
> I'm new to TCC, using version 0.9.26 under Windows XP Home 32-bit SP3.
> I would like to use the text on the Windows clipboard, so I wrote a
> small test program that #includes <windows.h>, and calls
> OpenClipboard(NULL), GetClipboardData(CF_TEXT), and CloseClipboard(),
> in that order. I ran it with the command line "tcc.exe test.c", and
> got the following error messages:
> tcc: error: undefined symbol 'address@hidden'
> tcc: error: undefined symbol 'address@hidden'
> tcc: error: undefined symbol 'address@hidden'
> I believe these error messages are generated by TCC's linker. The
> clipboard functions are in user32.dll.
> Please tell me what these messages mean, especially the "@n" parts,

The most important part of your question has already been answered,
but I'll handle this part.

Yes, these will be linker errors. The Windows API uses functions that
aren't quite defined like normal C functions. Both the object-file
level names and the way that you call these functions are different. I
think the function type is "stdcall", or something of the sort, but
you'll also see it referenced as "pascal" in some cases (note: I don't
think it's pascal, it's just that it's almost the pascal style, so
some people have gotten confused). The @ symbol is used to divide the
primary part of the name from a size description, which if I remember
correctly specifies the size of the argument list.

In some ways this is a nuisance, since it means that any Windows
compiler needs to either include it's own version of the Windows
headers, or support Microsoft's version, but in this case it's
actually somewhat convenient. The fact that the functions look
distinctively unlike other C functions is enough to let you know that
the missing functions are part of the Windows API (because everyone
else mostly uses standard C functions), instantly letting you know
1) The function declaration was compiled correctly,
2) It's a linker error, and
3) That it can be fixed by linking to the correct Windows component.

reply via email to

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