Libraries in C++ etc

Just starting out? Need help? Post your questions and find answers here.
PeterH
User
User
Posts: 28
Joined: Sun Apr 11, 2010 11:01 am

Libraries in C++ etc

Post by PeterH »

I'm gonna be perfectly honest. I haven't touched PB for quite some time due to me not being able to afford it just yet. When the (read; my) economy gets back on its feet I'm planning to do so (after the wedding probably). I've always been picky and always wanted stuff served to me on a silver platter, and therefor I need to know the following:

I previously used another basic compiler (without complete linux-support though) and stumbled upon some issues. Realized that libraries coded in C++ didn't always work with the language. They had to be modified and recompiled first. I'm not a C/C++ person, but I was curious if this could be an issue for me with PB as well?

I was mainly looking at decentralized p2p-networks so that any multiplayer support would not be depending on servers, and the clients can find eachother through the p2p-network instead (could help keeping the game alive years from now even if the author stops supporting it). Solutions like maidsafe-dht and bitdht seemed perfect, but when I realized that they are written in C++ I started wondering if this would be torture to implement.

Has anyone done anything similar to this? I suspect that bitdht would be the safest to use since it's so common and will probably be active several years from now. Since the libraries are already written and crossplatform it seemed quite dumb to reinvent the wheel for such a purpose.

Hope to be a part of the community "for real" soon. Cheers!
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Libraries in C++ etc

Post by IdeasVacuum »

Hello Peter. I think the lack of replies to your post is due to the fact that it is difficult to be definitive. PB works well with C/C++ libs, but of course nothing is perfect 100% of the time, same with any language, even C/C++ when using C/C++ libs. You may be able to put PB to the test using the free trial version. You can also search for keywords on this forum, there is a wealth of information on practically any subject.

So, it's really other criteria that needs to be judged - the functionality of the language, ease of use, support. PB has those in abundance and this is probably the best forum out there.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Libraries in C++ etc

Post by luis »

PeterH wrote: I previously used another basic compiler (without complete linux-support though) and stumbled upon some issues. Realized that libraries coded in C++ didn't always work with the language. They had to be modified and recompiled first. I'm not a C/C++ person, but I was curious if this could be an issue for me with PB as well?
Yes. C++ libraries (or the like in other object oriented languages) have a lot of issues due to name mangling and the fact they expect to be linked with a language supporting objects, so in PB you can try to interface to them building a wrapper in C++ exposing a plain C interface.
So you don't need the library's source. But you have to create the new-mid layer.

From PB you call the interfacing C functions, they in turn do the C++ objects instantiation and call the appropriate methods needed to implement the exposed C function.


So PB_function() ->

call C_Exposed_Function() inside your mid-layer, which in turn ->

instantiate object if needed from C++ library, call methods, returns values.
"Have you tried turning it off and on again ?"
Post Reply