A suggestion for the shared library implementation on Linux
tcak
tcak at pcak.com
Mon Feb 3 20:59:14 PST 2014
This is my first post in this forum. So hopefully it is the right
place for this topic.
Recently I saw this link http://dlang.org/dll-linux.html about
writing shared library on Linux. The annoying part has become
portability issues. Because my programme is linking to
libphoos.so, target platform is asking for many different
libraries.
When I look at the examples in that link, one thing is obvious
that we mostly use C, C++, and D together. But the thing is that
only D language has its own garbage-collector which is as far as
I understand the source of the problem.
If a C or C++ programme wants to use a D-shared-library, well,
only D is going to be using the garbage-collector.
If a D programme wants to use a D-shared-library, we want both
sides to use the same garbage-collector to prevent problems.
Since the main programme is changing only, and the library is
written in D language all the time, my suggestion is to add a
function into library on runtime to tell the library to use a
given garbage collector instance. Because C and C++ don't have
that, library will continue using its own.
P.S. I do not have knowledge about internals of
garbage-collector, this is just an idea.
More information about the Digitalmars-d
mailing list