tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Tinycc-devel Digest, Vol 153, Issue 11


From: Ben Hutchinson
Subject: Re: [Tinycc-devel] Tinycc-devel Digest, Vol 153, Issue 11
Date: Sun, 17 Dec 2023 23:19:50 -0800

I know this is an old post I'm replying to, but this is important. A technique I had learned for an earlier version of TCC no longer works. In particular, using inline ASM to strip the decorations from an exported STDCALL function, no longer works. Previously it worked, and was actually mentioned to me in this post which was a reply to my asking how to undecorate STDCALL functions. What is the solution now? How do you undecorate STDCALL functions now?

> Message: 3
> Date: Tue, 12 Jan 2016 13:02:44 +0100
> From: grischka <grishka@gmx.de>
> To: tinycc-devel@nongnu.org
> Subject: Re: [Tinycc-devel] I got this burning question about *.def
>         files and       TCC.
> Message-ID: <5694EB64.8000205@gmx.de>
> 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)
> {
>      ...
> }

On Tue, Jan 12, 2016 at 9:01 AM <tinycc-devel-request@nongnu.org> wrote:
Send Tinycc-devel mailing list submissions to
        tinycc-devel@nongnu.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.nongnu.org/mailman/listinfo/tinycc-devel
or, via email, send a message with subject or body 'help' to
        tinycc-devel-request@nongnu.org

You can reach the person managing the list at
        tinycc-devel-owner@nongnu.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Tinycc-devel digest..."


Today's Topics:

   1. I got this burning question about *.def files and TCC.
      (Ben Hutchinson)
   2. Re: Nevermind my previous comments. I just made an error.
      (Vincent Lefevre)
   3. Re: I got this burning question about *.def files and     TCC.
      (grischka)


----------------------------------------------------------------------

Message: 1
Date: Tue, 12 Jan 2016 03:01:59 -0800
From: Ben Hutchinson <benhut1@gmail.com>
To: tinycc-devel@nongnu.org
Subject: [Tinycc-devel] I got this burning question about *.def files
        and     TCC.
Message-ID:
        <CAD6iW2RX03zV9f0FMC5BHn2EDNGsGxi53aBSO3=FVN81ij7KzA@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nongnu.org/archive/html/tinycc-devel/attachments/20160112/621e814c/attachment.html>

------------------------------

Message: 2
Date: Tue, 12 Jan 2016 12:49:58 +0100
From: Vincent Lefevre <vincent@vinc17.net>
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Nevermind my previous comments. I just
        made an error.
Message-ID: <20160112114958.GK8584@cventin.lip.ens-lyon.fr>
Content-Type: text/plain; charset=iso-8859-1

On 2016-01-12 10:38:18 +0000, Edmund Grimley Evans wrote:
> For example, the ANSI spec says: "If the function is defined with a
> type that does not include a prototype, and the types of the arguments
> after promotion are not compatible with those of the parameters after
> promotion, the behavior is undefined." Seeing as the old compiler was
> unable to check that condition (it involves comparing types between
> translation units), what are the chances of the programmer having got
> it right in all cases?

This is the problem of the programmer. There are good chances that
this will not work (except in particular cases, such as between char,
signed char and unsigned char), though the programmer and/or the user
may not see the problem immediately. But this is also a good reason
to require prototypes: this will help programmers to detect bugs.

--
Vincent Lef?vre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



------------------------------

Message: 3
Date: Tue, 12 Jan 2016 13:02:44 +0100
From: grischka <grishka@gmx.de>
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] I got this burning question about *.def
        files and       TCC.
Message-ID: <5694EB64.8000205@gmx.de>
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
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


End of Tinycc-devel Digest, Vol 153, Issue 11
*********************************************

reply via email to

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