Jump to content
  • Advertisement
Sign in to follow this  

Wrappers

This topic is 4641 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I would like to know how many of you actually write own wrappers above 3rd part libraries ? I always have problems when I need to use a library for a specific task - I'm starting then to think about writing own library, just because I don't like in 100% the 3rd part library interface and I want to create all function names and class names as I like them.. But of course writing library from zero just for other interface is insanity, so the best solution is I think writing a wrapper over libraries.. Do you think it's a good solution to write wrappers or should I just get used to 3rd party library ? Writing a wrapper doesn't take so long time, but maybe it's just a waste of time which I could use for writing something else.. Thanks for answer.

Share this post


Link to post
Share on other sites
Advertisement
All the time [smile] I love simplicity, so I will always add my own wrappers to make life easier for me as well as anyone else that can use it. Now as for it being a waste of time, it just depends on what you are doing. For example, when you are using something such as ZLib, it's hard NOT to write your own wrapper to take care of stuff due to how the API works. However, with other things, such as let's say SDL_Mixer.

What do you have in mind right now?

Share this post


Link to post
Share on other sites
As you said, wrappers make life easier and this is one of the main reasons why I want to write them..

Now, for example, I'm searching for a low level network library. I have actually found only two interesting - HawkNL and SDL_net. Interface of both is quite far from what I like and I don't imagine writing a huge application using their interface. So I thinked about two solutions - write own library using winsock (I don't know if it could be called wrapper, because I would need to rewrite a lot of things) or to create wrapper over HawkNL/SDL_net.

Share this post


Link to post
Share on other sites
Real fast, have you taken a look at RakNet?

Ok back to what you have said, it's all a matter of how much effort you want to spend over the time ou have. If you have the time and patience to write what you need over WinSock, by all means, don't settle for anything less! However, if time is limited, you just might have to wrap a 3rd party library for your purposes. You will have to use your best judgement and choose what want to spend your time on. Good luck!

Share this post


Link to post
Share on other sites
I decided to write wrappers over libraries that do what I need, but interface isn't too comfortable for me. For sure I would learn more by writing own libraries rather than using 3rd part, but time spent on creating them isn't worth it I think. It's like reinventing the wheel ;]

And what to Raknet - for me it's too overloaded ;] I don't need all these stuff, maybe only few that I can write on my own with low-level library.

Thanks for help.

Share this post


Link to post
Share on other sites
zlib? That's like the only library I don't need a wrapper for. I did however put it in its own namespace.

All I need is two functions: compress and uncompress... it's quite simple.

Share this post


Link to post
Share on other sites
I wrap libraries when I dislike their functionality, not their naming conventions.

For example, SDL is a C-style library with no automatic cleanup (given that C has no dtors, I wouldn't expect this of SDL). However, I can wrap SDL to provide this functionality. I can even use the boost library to do it all for me:

boost::shared_ptr< SDL_Surface >( SDL_CreateSurface( ... ) , & SDL_FreeSurface );

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!