8000 Add new switch to rename a module in its mangling · Issue #21455 · dlang/dmd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add new switch to rename a module in its mangling #21455
Open
@rikkimax

Description

@rikkimax

Proposal: add a new switch similar to -mv in syntax, that renames a module in its mangling.

Benefit: it allows for multiple instances of a module be in a process, with minimal effort.
This is needed on Posix platforms, as each binary is not separated out at load time, all symbols intermix.

module perprocessregistration;

struct Thing;

void register(Thing);
module perbinaryregistration;
import perprocessregistration;

shared static this() {
    Thing[] things = ...; // get a list of things somehow that need registering
    foreach(thing; things) {
        register(thing);
    }
}

-mvm=perbinaryregistration=__somename1234

module someusage;
import perbinaryregistration;

void somethingToRegister(); // how this get to the module constructor in perbinaryregistration is unrelated to this ticket.

It must not alter module lookup, only how that module gets mangled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0