How to use an "unsupported" API call?

Linux specific forum
Ramihyn_
Enthusiast
Enthusiast
Posts: 314
Joined: Fri Feb 24, 2006 9:40 am

How to use an "unsupported" API call?

Post by Ramihyn_ »

I tried to use the "statfs" function but it seems the linux PB version doesnt "know" it. Is there a way to add the api call so PB Linux recognizes it?

Maybe some way to add it to the purelibraries/linux/glibc file? Or any way to call a unknown Api function?
freak
PureBasic Team
PureBasic Team
Posts: 5946
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

You can add new functions that can be used like the api ones with the so importer like on windows/mac as well.

Create a file 'somename.pbl' that contains the following:
The first line must contain the compiler commandline switch that you would
add to gcc to link the library in question. For example, for the pthread library,
this would be "-lpthread" (without the ").
Following is one line for each function to import. Each line consists of the function name,
followed by a space and then the number of parameters the function takes.
Example: "FunctionName 2" would be the line for a function with 2 parameters.

After creating the file, run the pbsoimporter program in the purebasic compilers directory.
It will create the needed files in the PureBasic directory.

After this, the commands in the file should be available like api commands,
with the underscore at the end.
quidquid Latine dictum sit altum videtur
Post Reply