How do i make a libary for Haiku OS

If i make a libary,then compile it into a .so file with a .h header,how do i put it in haiku OS’s libary path for headers and .so.

1 Like

I’ve never understood what .so stands for. I know .dll stands for Dynamically Loaded Library. But what does .so stand for?

In Haiku,there are many Shared Objects,which are pieces of code that each program can share,hence reducing the amount of space that all of the programs. Shared Objects are very important,as one computer genius can make a shared object that any non-genius can use. Once piece of code is created that someone wants to share,the same source code can be made for different Operating systems,so that everyone regardless of their OS can use that code without having to modify their own code to use their program on a new OS.

I am planning on making a framework that will allow programmers to interact with their code in new ways,such as porting software to other programming languages,and visualizing the structure of a program,or checking for syntax errors as you type,or even compiling as you type,(assuming i learn llvm ir code,which probably will).

I was writing this frame work in JS.but now i want to port what i have to C++(I dont remember why i started it in JS). One of the ingredients of my program is REGEXP functionality,so i compiled a regexp Shared Object,but im not sure where i can put the Shared Object and it’s headers so that it can be accessed by all programs. While i can keep the REGEXP shared object in my home folder and work with it from there,i fear what will happen when it is release time and i dont know where to put the files for others to use my Shared Objects to make plugins for my software and such

Well, in your case for self compiled libs by the user, you’d want to stick your library into ~/config/non-packaged/lib. As for your headers, just create a directory called “headers” in ~/config/non-packaged. As a note, you will still have to tell the compiler of that header directory.

Thank you,now i know where to put my libs,later will will learn to hpkg them,im getting c++ skills tunned as i was working with a lot of js

Are Shared Objects, in Haiku, the same thing as .DLL’s in Windows?

Yes. To make a shared object use

“g++ -c -fpic foo.cpp -o fooObject.o”

This makes an object,this object is pre-compiled now,and the code in foo.cpp doesn’t need to be compiled with the main program anymore

To use make this object into a shared object, do

“g++ -shared fooObject.o -o


To use this shared libary with your main program ,do

“g++ -L. -lfooObject -Wl,-rpath=. -o main main.cpp”
(be sure to cahnge the . to a folder(the “.” alone means the current folder))