Forgot your password?
typodupeerror
Programming Windows Technology

Platform Independent C++ OS Library? 310

Posted by timothy
from the one-to-rule-them-all dept.
quench writes "Hello! I have been away from Windows and Linux application software for 5 years or so, doing mainly C-like embedded C++ programming. Now, I am about to start a project emulating embedded hardware on Windows. Been there, doing #ifdef WIN32 and #ifdef LINUX stuff, don't really want to go there any more. What I actually need is a platform independent lib covering Windows and Linux variants to handle sockets, IPC and threads abstractions. And a rock solid but simple embedded database to emulate flash memory. My reflex said, go for ACE and Berkeley-DB. Tell me, am I out of time? Am I missing something new and trendy, easier to use and better? Did time stand still?"
This discussion has been archived. No new comments can be posted.

Platform Independent C++ OS Library?

Comments Filter:
  • many choices (Score:2, Interesting)

    by Anonymous Coward on Sunday October 11, 2009 @02:27PM (#29712597)

    NSPR [mozilla.org], APR [apache.org], boost [boost.org] system, threads

  • by Wrath0fb0b (302444) on Sunday October 11, 2009 @02:32PM (#29712625)

    Intel Thread Building Blocks (http://www.threadingbuildingblocks.org/ [threadingb...blocks.org] is (are?) fantastic. Open source (GPL), works on any ISO-compliant C++ compiler and is fairly intuitive. It allows both high-level (parallel_for) and low level (task-based) parallelism. Particularly useful are the concurrent containers, since it saves you from reimplementing these basic structures.

  • Re:Qt (Score:1, Interesting)

    by Anonymous Coward on Sunday October 11, 2009 @02:36PM (#29712657)

    Remember one thing about LGPL. It requires that that user can replace the LGPL binary. So Qt released under LGPL must be a separate dll, no static linking.

    Although, I cannot understand how iPhone and its apps get by this license requirement.

  • Re:Pthreads (Score:3, Interesting)

    by QuoteMstr (55051) <dan.colascione@gmail.com> on Sunday October 11, 2009 @02:47PM (#29712723)

    pthreads-win32 is excellent, but regrettably, LGPL licensed. It's interesting to note how complex it has to be to give you POSIX semantics [wustl.edu] --- pre-Vista win32 threading primitives are fundamentally flawed [msdn.com].

    Vista, on the other hand, gives us brand-new innovative 21st-century Microsoft technologies like condition variables [microsoft.com].

  • Re:ACE is great! (Score:3, Interesting)

    by mallan (37663) on Sunday October 11, 2009 @03:04PM (#29712801) Homepage

    Qt has been modular since ver 4, so you don't have to include the GUI components if you don't want to. The API is clean, elegant and consistent, plus the documentation is great. I don't have anything bad to say about ACE or Boost - they're both high quality toolkits - but if I had to choose just one toolkit to use for the rest of my life, it'd be Qt, hands down.

  • by Anonymous Coward on Sunday October 11, 2009 @03:04PM (#29712803)

    ACE introduced a lot of neat concepts into the mainstream as far as I/O goes (the Reactor pattern came from ACE) but it's really quite crufty and showing its age. It's probably the best thing there is for wrangling heavily-threaded apps, but you'll have to deal with threads more than you'll care for. You'll find the APIs in Boost and QT to be a lot nicer.

    As for Berkeley DB, it's very nice, battle-tested, and perfectly suited for the type of task you're looking at.

  • Cygwin or UWIN (Score:5, Interesting)

    by jdb2 (800046) * on Sunday October 11, 2009 @03:10PM (#29712831) Journal
    If you want "close to the metal" POSIX API compatibility then there's Cygwin [cygwin.com] which is easier to use IMO and more actively developed but doesn't support the *full* POSIX spec or there is UWIN [att.com] which supports most of the POSIX spec.

    Combine this with OpenGL [opengl.org], OpenAL [creativelabs.com], the SDL [libsdl.org] and Cygwin/X [cygwin.com], QT [nokia.com], a Java layer using the SWT [eclipse.org] from Eclipse, *shudder* GLUT [opengl.org] *shudder* ;) or IMNSHO preferably wxWindows/wxWidgets [wxwidgets.org] and you've got yourself a full cross-platform programming toolkit that can do just about anything.

    jdb2
  • Re:ACE is great! (Score:1, Interesting)

    by Anonymous Coward on Sunday October 11, 2009 @03:20PM (#29712881)

    Avoid ACE, it is really poor. Have you every tried to compile and build it on modern systems? It just does not build. It looks like the project has been abandoned to me.
    I tried to build it on 5 modern UNIX OSs recently and they all failed. The main reason is that the C++ code is poor written and C++ is not very portable because the C++ compilers only implement parts of the standard.

  • Re:JAVA (Score:4, Interesting)

    by HiThere (15173) <`charleshixsn' `at' `earthlink.net'> on Sunday October 11, 2009 @03:25PM (#29712903)

    That's not really a bad suggestion. Ruby, Python, even some dialects of Basic would work.

    Also consider Pascal. There are dialects of Pascal that have strongly attempted to be identical across platform boundaries.

    Additionally, anything that's running on a virtual machine would be a reasonable consideration. That includes qemu and xen, not just Java, Python, etc.

    What's at question are "What are the requirements??". Without knowing that, there's no way to know which, if any, of these suggestions are reasonable. Given that the initial language is C++, I'd expect that Pascal is the best replacement, with Java a close second. But if speed isn't a limiting factor than the other suggestions should be given consideration.

    Of course, what he's asking it probably more readily answered by something like FLTK, but it's hard to know, since we don't know exactly which features he needs to be handled by his library. FLTK is platform independent, and callable from C++, but pretty much only handles the graphic interface. If that's all he needs, then it's a good answer, but we don't know what his needs are.

  • Re:Qt (Score:5, Interesting)

    by jmv (93421) on Sunday October 11, 2009 @03:30PM (#29712941) Homepage

    I've once attempted to use Gtkmm for a new project. While the API is generally well designed, I found that the documentation for many features was totally inexistant. Even more annoying was the fact that some components were either buggy or not wrapped (from C Gtk) at all. Combined with the fact that components get created and deprecated at a huge rate, you don't even know what you should be using. Overall, I've had a really bad experience with Gtk (and especially gnome) development. I've only tried using Qt a little bit and so far I like it a lot. I've never done GUI with it though. I've used the "platform independent system library" part for things like threads, sockets and the like. The only thing I found a bit annoying was that it didn't integrate well with the STL.

  • Boost and sqlite (Score:4, Interesting)

    by rudedog (7339) <dave.rudedog@org> on Sunday October 11, 2009 @03:35PM (#29712963) Homepage

    For most cross-platform stuff, boost will do what you need. boost::thread will handle all of your threading needs.

    boost::filesystem for manipulating pathnames; boost::datetime for date and time operations; boost::format for typesafe printf style I/O.

    It also has boost::asio for sockets and boost::interprocess for IPC. I know nothing about them, but to judge from the quality of the rest of the boost library, they are probably very good.

    For database, use Sqlite. It's a solid relational database stored in a single file, and you can even access the database from the command line for ad-hoc queries/debugging/whatever.

  • SQLite for database (Score:3, Interesting)

    by PizzaFace (593587) on Sunday October 11, 2009 @03:50PM (#29713061)
    SQLite [sqlite.org] dominates discussions of embedded databases these days, but Berkeley DB [oracle.com] still has fans who don't need SQL. There are a lot of comparisons on the web.
  • by EvilIdler (21087) on Sunday October 11, 2009 @04:50PM (#29713513)

    There's always wxWidgets, which you can compile into your program if you feel like it. Quite liberal.
    It's not a mere library, but a full framework, like Qt. I find the wx runtime to be smaller than an equivalent Qt program most of the time, and the Mac version of Qt's dylib bundler sometimes makes some stupid decisions which bloat the app by 50MB. wxWidgets (statically linked) gives me a 1.7MB executable for a Hello World-ish program.

  • by Trepidity (597) <delirium-slashdot@@@hackish...org> on Sunday October 11, 2009 @05:02PM (#29713629)

    C++ has a lot of properties, but "simple" is hardly one of them. It's got so much stuff munged into it that the spec contains literally hundreds of pages special-casing bad interactions between features, and it takes a gigantic effort just to determine the type of an expression. Parsing C++ is actually not only not context-free, but undecidable, in general. It takes a heroic effort to determine whether A f(B,C); is a function declaration, or a call to a constructor. Static resolution rules are horrifically complex. The interaction of templates with everything else in the language is riddled with pitfalls. Etc.

  • by Anonymous Coward on Sunday October 11, 2009 @06:04PM (#29714031)

    I have long given up using the threading module in python itself, and have actually been using the Parallel Python module written by Vitalii Vanovschi extensively for my parallel processing needs. If you need multi-core / cluster processing and want to stick with python, this library is quite excellent. http://www.parallelpython.com

  • Re:Qt (Score:3, Interesting)

    by Doppler00 (534739) on Sunday October 11, 2009 @06:12PM (#29714095) Homepage Journal

    Qt is okay for networking applications, but in my experience Boost has much, much better performance, not to mention better support for things like multicast without creating some hacks. Qt ends up using a lot of Qt specific classes internally to create buffers and network functions, so it ends up being slower than Boost which seems to act more as a wrapper than anything.

  • Re:Boost? (Score:3, Interesting)

    by Pseudonym (62607) on Sunday October 11, 2009 @09:15PM (#29714885)

    That's correct. Boost has the most stringent code review practices of probably any open source project.

    This seems like an anti-open-source thing to do, but it's critical considering what Boost has to do. It's partly that library of infrastructure that all serious C++ projects need before they start, and partly the place where additions to the standard library are born. Boost development is slow, but Boost code is bulletproof.

  • by cerberusss (660701) on Monday October 12, 2009 @12:30AM (#29715865) Homepage Journal

    C++ has a lot of properties, but "simple" is hardly one of them.

    We use Qt at my job for creating servers, daemons, interacting with hardware as well as doing GUI stuff. You don't really need to use the fancy C++ stuff, it's OK to just use the Qt classes and be done with it. Our code almost looks like Java, so simple.

It was kinda like stuffing the wrong card in a computer, when you're stickin' those artificial stimulants in your arm. -- Dion, noted computer scientist

Working...