tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] How do I rename exported DLL function?


From: Vladimir Vissoultchev
Subject: Re: [Tinycc-devel] How do I rename exported DLL function?
Date: Tue, 14 May 2019 23:18:10 +0300

Hi,

 

I just pushed a simple fix for the asm_label hack that's used to specify DLL export name and accidentally got dropped in 0.9.27

 

https://github.com/TinyCC/tinycc/commit/1dd6842654c8f8f6bf1a94364f0fd23ed10cc7e1

 

It seems I cannot push to mob as of now. Someone care to merge?

 

cheers,

</wqw>

 

From: Tinycc-devel [mailto:address@hidden On Behalf Of Ben Hutchinson
Sent: Tuesday, May 14, 2019 10:15 PM
To: address@hidden
Subject: Re: [Tinycc-devel] How do I rename exported DLL function?

 

Thanks for the info. It does make it a lot simpler now with the nodecorate attribute.

 

However, I remember that back in 0.9.26 there was a different way. You could use the __asm directive and then type the desired name of the function, and it would override the name that the compiler tried to give it. For example, For a function called TestFunc you could do this when declaring your function.

__attribute((dllexport,stdcall)) int TestFunc(int arg1,int arg2) __asm("TestFunc");

__attribute((dllexport,stdcall)) int TestFunc(int arg1,int arg2){

//do some stuff

}

 

The first line guaranties that the function called TestFunc in the source code was called also called TestFunc (without any decoration) in the DLL (though you could also use this technique it to rename it to anything you wanted). That worked in 0.9.26, but I have discovered to my surprise, that this no longer works in 0.9.27. This means source code written by users of 0.9.26 can't be directly compiled in 0.9.27. The code will NEED to be edited to use the new attribute instead of the __asm directive, breaking backward compatibility. Please fix this. Any code that compiled successfully in a previous version of TCC should also compile without any changes in the current version.I consider this breaking of backward compatibility to be a bug.

 

On Mon, May 13, 2019 at 9:07 AM <address@hidden> wrote:

Message: 2
Date: Mon, 13 May 2019 12:29:14 +0100
From: Jonathan Newman <address@hidden>
To: address@hidden
Subject: Re: [Tinycc-devel] How do I rename exported DLL function?
Message-ID:
        <CAN=address@hidden>
Content-Type: text/plain; charset="utf-8"

I added a "nodecorate" attribute a while ago to handle this (it just
suppresses the addition of "_" and "@n"). It would be nice to add support
for reading .def files at some point...


reply via email to

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