Can you explain a bit more of that, step by step?

Why is stdlib.h used here?

Also, I thought that to set attributes like dllexport, you needed to use
__attributes__((dllexport)) directive, not __declspec (which isn't even
mentioned in the TCC manual). Also, I thought that to make it stdcall, you
needed to use __attributes__((stdcall)), not a standalone __stdcall. These
are the "weird" things that set TCC apart from all other C compilers I
thought, yet you say these C compiler standards also work in TCC?

And by the way, I think __stdcall (with 2 underscores) for setting the use
of STDCALL calling convention is a Microsoft thing (as used in VC++). The
official C standard for setting the use of STDCALL calling convention is
actually supposed to be _stdcall (with 1 underscore). Isn't that correct?

And why use asm("zzz") as in your example? I think that sets up the
compiler for compiling assembly code, not C code, meaning the function must
then be written in assembly language.



> Message: 3
> Date: Tue, 12 Jan 2016 13:02:44 +0100
> From: grischka <[email protected]>
> To: [email protected]
> Subject: Re: [Tinycc-devel] I got this burning question about *.def
>         files and       TCC.
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Ben Hutchinson wrote: ---
> > I asked it before as part of a 2 part post, but only part of that post
> was
> > replied to. So this question is still in play:
> >
> > Is there a way to set your exported functions with *.def files? I notice
> it
> > usually automatically generates a *.def file when you use the
> > __attributes__((dllexport)) directive. Is there a way to get it to READ,
> > rather than write, a *.def file when exporting functions from a DLL, and
> in
> > so doing, allow the *.def file to select which functions are exported? I
> > really would like to know, so that I can undecorate my stdcall functions,
> > via the use of *.def files.
>
> No.  An "asm label" can do that though:
>
> #include <stdlib.h>
> __declspec(dllexport) int __stdcall fff(int a, int b) asm("zzz");
>
> int __stdcall fff(int a, int b)
> {
>      ...
> }
>
> exports "zzz" instead of "_fff@8".  Thanks.
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Tinycc-devel mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>
> End of Tinycc-devel Digest, Vol 153, Issue 11
> *********************************************
>
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to