www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [SAoC 2021] Solve Dependency Hell: Milestone 1, Week 1

reply Ahmet Sait <nightmarex1337 hotmail.com> writes:
[Milestone 
Overview](https://gist.github.com/ahmetsait/10925a246b0d412a698e927658f3f363#milestone-overview)

Hi,
This week I've been mostly reading & learning about name mangling 
from the [language 
spec](https://dlang.org/spec/abi.html#name_mangling), [official 
blog](https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/) and the
[DMD's source](https://github.com/dlang/dmd/blob/master/src/dmd/dmangle.d).

I've implemented parsing an additional command line switch 
`-mangle-suffix` to get my hands dirty with hacking on DMD 
codebase (see [my mangle-switch 
branch](https://github.com/ahmetsait/dmd/tree/mangle-suffix)). 
Admittedly, it wasn't exactly productive since I had summer 
school finals but I have a lot more time available in these 
upcoming weeks to compansate.

Next week I plan to experiment with mangling code to see where 
can I get in implementing the `-mangle-suffix` semantics.
```d
//app.d
module app;
int foo(int x)
{
     return x * x;
}
```
Above code currently produces a `_D3app3fooFiZi` symbol when 
compiled. The idea is to make it `_D3bar3app3fooFiZi` if 
`-mangle-suffix=app.d:bar` is passed.

I'm checking out https://wiki.dlang.org/DMD_Source_Guide for now 
but it seems somewhat outdated, hopefully the community here can 
endure me bombarding them with questions about DMD codebase.

Thanks.
Sep 24
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 9/24/21 2:35 PM, Ahmet Sait wrote:

 Above code currently produces a `_D3app3fooFiZi` symbol when compiled.
 The idea is to make it `_D3bar3app3fooFiZi` if
 `-mangle-suffix=app.d:bar` is passed.
suffix or prefix? "bar" seems to prefix at least some part of the existing name but it doesn't look like a suffix to me. :) Ali
Sep 24
parent Elronnd <elronnd elronnd.net> writes:
On Friday, 24 September 2021 at 22:21:38 UTC, Ali Çehreli wrote:
 On 9/24/21 2:35 PM, Ahmet Sait wrote:

 Above code currently produces a `_D3app3fooFiZi` symbol when
compiled.
 The idea is to make it `_D3bar3app3fooFiZi` if
 `-mangle-suffix=app.d:bar` is passed.
suffix or prefix? "bar" seems to prefix at least some part of the existing name but it doesn't look like a suffix to me. :)
Since it's not strictly a prefix either, perhaps 'affix' or even 'tag' would be better.
Sep 25