On Wednesday, 8 November 2023 at 11:48:58 UTC, BoQsc wrote:
I would like to export some functionality as external shared dynamically linked D library.

Is it possible to do that in D Language

Yes, as long as the symbols you want to use externally are `public`, which is the default. When it comes to linking, the main factor is usually matching symbol mangling. In C you would help users do this by distributing your header files. In D it's more common to distribute your source code, so if you want to distribute a "header" you'll need to remove your function bodies:
```d
//regular function:
int add(int x, int y) nothrow{
  x += y;
  return x;
}

//for a D "header":
int add(int x) nothrow;
```

what are limitations?

The desired template instantiations must be generated at compile time, not at link time. CTFE probably won't work.

Example of shared dynamic libraries depending on other shared dynamic libraries would be great as well.

There should be no material difference to using a shared library from an executable binary.

Reply via email to