Own Dynamic linking libraries

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
chinnambhrt
Posts: 7
Joined: Sun Nov 02, 2014 12:58 am

Re: linking error new operator

Post by chinnambhrt »

Okay thanks guys..i'm done with this..
but kicked off with a new problem again..
I wanted to define my own dynamic link libraries..with some new extension...say *.oslib...
how do i approach for this..?
like essentials, setup, knowledge..etc
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: linking error new operator

Post by Combuster »

chinnambhrt wrote:Okay thanks guys..i'm done with this..
but kicked off with a new problem again..
I wanted to define my own dynamic link libraries..with some new extension...say *.oslib...
how do i approach for this..?
like essentials, setup, knowledge..etc
The colours prove you didn't read the forum rules yet. They contain many more hints that prove helpful in getting a meaningful answer.

Regardless, understanding the internals of the language is certainly a prerequisite and it would not be wise to consider shared libraries when you don't have a functional memory allocator either.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: linking error new operator

Post by sortie »

You can customize your toolchain by making a OS Specific Toolchain. There is nothing magical about the .so extension, though, so you can just name your output files that.

This is advanced. It is not relevant until you make a user-space. I suspect that's in a good while for you.
chinnambhrt
Posts: 7
Joined: Sun Nov 02, 2014 12:58 am

Own Dynamic linking libraries

Post by chinnambhrt »

I wanted to define my own dynamic link libraries..with some new extension...say *.oslib...
how do i approach for this..?
like essentials, setup, knowledge..etc

help is greatly appreciated...Thanks in advance
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Own Dynamic linking libraries

Post by SpyderTL »

The Wikipedia entry for "DLL" is actually pretty helpful.

http://en.wikipedia.org/wiki/Dynamic-link_library

I would recommend starting there.

It would also be helpful if we knew the context of the environment that you are working in (or working on...).

Is this for a new OS that you are writing from scratch? Or is this going to be for an existing OS that you are modifying? Are you writing your own compiler/linker?

How far along are you? (Just getting started, almost finished, not even started, etc.)

You should get to know the PE file format inside and out, as that will give you a jump start on the kind of issues that you are going to need to deal with in your file structure.

Also, just to get it out of the way, because I know that someone is bound to ask... Why not just use an existing format (like ELF or PE) that is already supported by every other OS and compiler/linker?
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
no92
Member
Member
Posts: 307
Joined: Wed Oct 30, 2013 1:57 pm
Libera.chat IRC: no92
Location: Germany
Contact:

Re: Own Dynamic linking libraries

Post by no92 »

PE itself is not a requirement. What you should know is any executable format capable of some things you'll need for dynamic linking, e.g. symbol tables.

*.so, *.dylib and *.dll files are basically the same things as a kernel module, all four have to be linked at runtime. They are just four names for the same thing.

In order to do this, I usually create my own spec. Write your own one and be friends with it. Second off, you might want to put some information about the module (entry/exit point, name, whatever) in a dedicated section of the shared object. The methods that the module provides are called through special methods (dlsym for Linux). You have to pass the name of the method. What dlsym does it to look it up on the symbol table.

These ideas can get you started. Digging inside the kernel or some hobby OSs (given that it implements it) can help, too.
Post Reply