Dear community,
I want to create a library which is usable from C and D.
D should be a first class citizen and C because of FFI for other languages.
The lib is compiled with -betterC

Because C does not have namespaces i want to add the prefix of the lib like "leogfx" but in D i don't want that because we don't need this.

So i guess i could do either this

```d
struct BufferDesc {
    uint type;
    uint usage;
    size_t size;
    void* ptr;
}

extern(C):

private {
    bool pInit() {
        return true;
    }
}

version(LibUsedFromDlang) {
    bool init() => pInit();
} else {
    bool leogfxInit() => pInit();
}
```

Or that

```d
struct BufferDesc {
    uint type;
    uint usage;
    size_t size;
    void* ptr;
}

extern(C):

bool leogfxInit() {
    return true;
}

alias init = leogfxInit;

```

I don't like the first one because I don't like to wrap everything. I'm not to keen on the second because of the developer experience with intellisense etc. Is there something I'm missing ? Do I need to go the template route with even worse developer experience ?

Kind regards,
Max

Reply via email to