Topic says all.
I only have the .lib and the c++ header.
Is there any way?
The best way is to convert the .lib to a .dll or write a dll with both like a wrapper.
But i´m no c++ prof.
Is it possible to use a .lib written with C++ in pb?
Re: Is it possible to use a .lib written with C++ in pb?
yes, use ImportN_Gnom wrote:Topic says all.
I only have the .lib and the c++ header.
Is there any way?
The best way is to convert the .lib to a .dll or write a dll with both like a wrapper.
But i´m no c++ prof.
Re: Is it possible to use a .lib written with C++ in pb?
You can do it using a wrapper or sometimes directly.
With the wrapper is easier and foolprof, you just need some time to write a thin layer of C functions to be called by PB.
Directly is a lot more difficult.
http://www.purebasic.fr/english/viewtop ... 13&t=46203
http://www.purebasic.fr/english/viewtop ... 13&t=52522
http://www.purebasic.fr/english/viewtop ... 12&t=54604
Some pointers about demangling
http://www.purebasic.fr/english/viewtop ... 12&t=53808&
With the wrapper is easier and foolprof, you just need some time to write a thin layer of C functions to be called by PB.
Directly is a lot more difficult.
http://www.purebasic.fr/english/viewtop ... 13&t=46203
http://www.purebasic.fr/english/viewtop ... 13&t=52522
http://www.purebasic.fr/english/viewtop ... 12&t=54604
Some pointers about demangling
http://www.purebasic.fr/english/viewtop ... 12&t=53808&
"Have you tried turning it off and on again ?"
Re: Is it possible to use a .lib written with C++ in pb?
Directly doesn´t work for me.
A friend and i have tested the .lib to import the exported functions...no result.
With a seperate tool(the name of it i forget) we could only see one main function wich is exported...
So the only way is the write a wrap with the .lib and the header.
But i don´t write in c++ and so i don´t nothing about doing that.
A friend and i have tested the .lib to import the exported functions...no result.
With a seperate tool(the name of it i forget) we could only see one main function wich is exported...
So the only way is the write a wrap with the .lib and the header.
But i don´t write in c++ and so i don´t nothing about doing that.
Re: Is it possible to use a .lib written with C++ in pb?
is the lib a static lib or simply an import lib?
Re: Is it possible to use a .lib written with C++ in pb?
The usual answer for this question is: no. You have to create small wrapper in C to expose the C++ functions you need, PB doesn't handle direct import.
Re: Is it possible to use a .lib written with C++ in pb?
So PB can only import libraries written in C?
Re: Is it possible to use a .lib written with C++ in pb?
PB can only (easily) import plain functions. If a library is written in C++
but provides an external plain C interface, that's fine.
Of course also other languages can be used as long as they follow the same conventions.
but provides an external plain C interface, that's fine.
Of course also other languages can be used as long as they follow the same conventions.
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Re: Is it possible to use a .lib written with C++ in pb?
If a c++ lib exports functions as extern c or stdcall then you can import them
If a c++ lib exports classes with pure virtual functions you can import them via interfaces, except on windows x86
unless you use a thiscall patch/hack. x64 and x86 on linux and osx will all work with pb interfaces
If the c++ lib is a com library you can import it via interfaces or use srods comate tool
If a c++ lib exports classes with pure virtual functions you can import them via interfaces, except on windows x86
unless you use a thiscall patch/hack. x64 and x86 on linux and osx will all work with pb interfaces
If the c++ lib is a com library you can import it via interfaces or use srods comate tool
Windows 11, Manjaro, Raspberry Pi OS


Re: Is it possible to use a .lib written with C++ in pb?
You can import them on x86 too if you declare methods as virtual and with __stdcall. I did it before but it's quite a pain in the rear since you also need to worry about the correct order of definition. Definitely not recommendable.
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds