www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How do I make/use my own run-time library?

reply %u <wfunction hotmail.com> writes:
Hi,

I've been trying to make my own run-time library for D, but I've come across a
dead end: *any* library I make will inherently depend on SNN.lib, and there
are no headers for that C run-time library.

How can I write my own library in place of SNN.lib if I do not know what the
function specifications are? (My entire goal here is to write my own
counterpart of SNN.lib, so I can't really avoid the issue.)

Thank you!
Dec 26 2010
next sibling parent reply "Simen kjaeraas" <simen.kjaras gmail.com> writes:
%u <wfunction hotmail.com> wrote:

 Hi,

 I've been trying to make my own run-time library for D, but I've come  
 across a
 dead end: *any* library I make will inherently depend on SNN.lib, and  
 there
 are no headers for that C run-time library.

 How can I write my own library in place of SNN.lib if I do not know what  
 the
 function specifications are? (My entire goal here is to write my own
 counterpart of SNN.lib, so I can't really avoid the issue.)
It should be possible to get the interface of SNN.lib using libunres. I am however not aware of the specifics. -- Simen
Dec 26 2010
parent %u <wfunction hotmail.com> writes:
Thank you for the response!
Unfortunately, though, that only gives me the name of the C functions, not the
actual headers. I need to know the parameters and return type of each function
in
order to be able to replace the library.
Dec 26 2010
prev sibling next sibling parent Don <nospam nospam.com> writes:
%u wrote:
 Hi,
 
 I've been trying to make my own run-time library for D, but I've come across a
 dead end: *any* library I make will inherently depend on SNN.lib, and there
 are no headers for that C run-time library.
 
 How can I write my own library in place of SNN.lib if I do not know what the
 function specifications are? (My entire goal here is to write my own
 counterpart of SNN.lib, so I can't really avoid the issue.)
 
 Thank you!
AFAIK druntime contains signatures for everything which is used from snn.lib. If you just make a .lib file from a blank file, and rename it to snn.lib, you'll get linker errors for everything which is used from it. You can then search for their signatures in druntime.
Dec 28 2010
prev sibling parent %u <wfunction hotmail.com> writes:
Hi,

I've gotten rather far with making my own run-time library, and I've gotten
pretty
far. The only problem now seems to be this first line in lifetime.d:

extern (C) void[] _d_arrayappendT(TypeInfo ti, Array *px, byte[] y)
{
    size_t offset = px.data - __arrayStart(info);
    //...
}

For some weird reason, I'm getting an offset of 0xFFFFFFF0, because px.data is 0
and __arrayStart(info) is 16.

Does anyone have an idea why this might happen?
Things I've changed: I've basically unlinked from most of SNN.lib except a very
few object files I've extracted from it. Might the lack of anything in there
cause
this?

If I manage to get the code working well, I'll definitely try to share it, since
it lets you link dynamically to msvcrt.dll instead of statically to snn.lib --
and
I think people will like that. :)

Thank you!
Jan 04 2011