Platform Independent C++ OS Library?
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 platform independent lib you are looking for is called JAVA.
Nokia QT rocks...
I know Boost has threading support, but I'm not sure how much. Have you looked at that? (It also has a bunch of other useful libraries, perhaps Filesystem being pretty useful for cross-platform work.)
A cat can't teach a dog to bark.
NSPR, APR, boost system, threads
Use Qt. It's LGPL (So it's free for commercial projects as well), is well documented and offers a ton of abstractions (including sqlite).
http://qt.nokia.com/
And tool support is excellent as well (Visual Studio Add-In, Eclipse Plugin and a standalone IDE called QtCreator).
JUCE (www.rawmaterialsoftware.com) can handle IPC and threads, don't know about sockets. No integrated DB though, and it's primarily a GUI and media thing. Lots of integrated real time audio stuff etc. so it might be too heavy weight for your purposes.
I've used Pthreads successfully as a cross-platform threading library. http://sourceware.org/pthreads-win32 is a quite good implementation for Windows, and it's built into Linux (and all other POSIX compatible OS's, such as OS X, as well).
"I'm too busy to research this and form an educated opinion, but I do have time to tell everyone my uninformed opinion."
a *lot* has happened in C++ recently. you might want to check out TR1, c++0x, boost::thread and (boost::)asio
Qt's "Core" library is a pretty solid platform shim. Plain GLib is also (somewhat easier to port due to no C++ ABI differences, but no native C++ api makes it less attractive to you).
Either one is an exceptional choice.
"Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
Intel Thread Building Blocks (http://www.threadingbuildingblocks.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.
Boost has libraries for each of these three: sockets through the ASIO library, IPC through the Interprocess library, and threads through the threads library.
http://www.boost.org
The only thing that Boost is lacking for which you asked is a database library.
boost
IANA C guru but maybe Apache Portable Runtime? Seems to be more lightweight than QT.
I've had great experiences with ACE. I found ACE to be dependable and extensive. You don't even have to use the higher level design patterns to get the platform independence.
If you're targeting *only* Windows and Linux, then Qt may also be a good option. I'm not sure if you can strip out the GUI stuff if you don't need it.
APR
Last time I did c++ i used Boost.
-Alex. http://bit.ly/1iVPtfA
You can come up with your own runtime system that runs on all platforms and has its own library and primitives. However, you'd have to throw away the powerful system programming concepts of linux/unix that simply don't have anything equivalent on the Windows side. For example, fork() is not available, which is a shame since fork() is essential for starting background processes in a controlled fashion (have the parent initialize, fork and exit).
Python and Java have the same problem and are reduced to lame multithreading where native asynchronous programming would do the trick in a clearer and more natural way.
Really? These are moded trolls for expressing an opinion? I thought that's in essence what the poster was looking for. ./ is getting increasingly tedious.
Boost ( http://www.boost.org/ ) is good I also hear nice things about POCO http://pocoproject.org/
wxWidgets (aka wxWindows) does windowing, sockets, thread. I am not sure about DB, but I think it does. I haven't used it for DB yet.
---- aut viam inveniam aut faciam
As others have said BOOST is good. Also, I really didn't care for ACE and eventually gave up on it.
I use Poco C++ Libraries and highly recommend it. It offers conceptual integrity throughout the component libraries, with a very generous open source license.
It doesn't include a GUI library. Poco is more of a platform abstraction API. I cross-built Poco C++ Libraries for ARM9 and have experienced very good results the last 1.5 years. Zero Poco issues. Using the Poco abstractions for threads, mutexes, and network operations (both UDP and TCP).
Poco includes SQLite integration and Expat XML parser integration. I experimented with both successfully, although they are not used in my commercial product that uses Poco.
If Qt had been free when I began, I would have considered it. Poco was already free so it was an easy choice once I became familiar with it. Poco is actively maintained, and commercial support is available if wanted.
Poco C++ Libraries. Highly recommended.
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.
TFA - Whats the best hack for c++ to let it be cross platform?
Everyone - Use this mish-mash of open source libraries and/or reinvent the wheel when you have to with interfaces and separate code files for OS specifics.
Me - Use a language and SDK that is MADE FOR CROSS PLATFORM COMPATIBILITY. JAVA JAVA JAVA
JAVA has cross platform sockets
JAVA has cross platform threads
JAVA has cross platform gui
C++ has header files... F**K HEADER FILES
C++ has pointers to pointers... F**K MEMORY MANAGEMENT
C++ makes you feel smart when you get something to actually work correctly... F**K YOUR EGO
http://www.nullsoft.com/free/jnetlib/ From the guy who initially made Winamp, he also made a lib called JNetLib which is a piss easy to use cross-platform C++ socket library. It also has pre-made classes for things like HTTP/HTTPS, to help speed things up, or to simply give you an idea of how to use the library. It is licensed under the BSD license, so you are basically free to use it for whatever you would like, commercial or otherwise.
If you want "close to the metal" POSIX API compatibility then there's Cygwin which is easier to use IMO and more actively developed but doesn't support the *full* POSIX spec or there is UWIN which supports most of the POSIX spec.
;) or IMNSHO preferably wxWindows/wxWidgets and you've got yourself a full cross-platform programming toolkit that can do just about anything.
Combine this with OpenGL, OpenAL, the SDL and Cygwin/X, QT, a Java layer using the SWT from Eclipse, *shudder* GLUT *shudder*
jdb2
Zoolib at Source Force under the MIT open source license. It has a flat file database format, exists for multiple platforms, has platform-independent thread and mutex classes, graphical user interface toolbox, thread-safe reference counted smart pointers, file access, TCP networking. You can ask the main developers Andy Green or Michael Crawford to port it to a new platform that isn't supported yet, but it supports all of the platforms listed on the source forge page.
The Zoolib Cookbook can help you get started.
The flat file database support is designed in Zoolib so that you can email someone the database file and they can click on it and open it up as an email attachment.
Remember, Slashdot does not have a -1 disagree moderation, and no, troll, flamebait, and overrated are not substitutes.
I use Poco C++ Libraries and highly recommend it. It offers conceptual integrity throughout the component libraries, with a very generous open source license.
It doesn't include a GUI library. Poco is more of a platform abstraction API. I cross-built Poco C++ Libraries for ARM9 and have experienced very good results the last 1.5 years. Zero Poco issues. Using the Poco abstractions for threads, mutexes, and network operations (both UDP and TCP).
Poco includes SQLite integration and Expat XML parser integration. I experimented with both successfully, although they are not used in my commercial product that uses Poco.
If Qt had been free when I began, I would have considered it. Poco was already free so it was an easy choice once I became familiar with it. Poco is actively maintained, and commercial support is available if wanted.
Poco C++ Libraries. Highly recommended.
If you use Berkeley-DB, watch out for the Oracle licensing.
Unfortunately all the trendy cool kids are using Java these days, and only web-based applications are worth working on if you want to keep up with the times. The days of small, simple client-server apps are over, old hat, out of date, archaic. Nowadays you need to implement a web application using AJAX, web services, Struts and Spring and Hibernate, and you have to do it using Agile methodology. If you aren't linking in at least 100 Java class libraries, you don't have a "real" application.
C++? Too simple.
By the taping of my glasses, something geeky this way passes
Qt and Wx are both open-source cross-platform libraries. However, doing anything cross-platform in C++ is a pain. You're probably better off using Python, Mono, or Java.
#ifdef __BSD__
BSD and linux are different in some aspects when it comes to sockets. Made it a real PITA to code on linux, runs perfectly, then won't compile on BSD without a few more includes and some extra code.
yeah, Qt is made for C++ (despite there are plugins for Java and Python)
and get off my damn lawn!
QQ I need cross platform development but I'm stubborn and have to use C++.
Well you just need a combination of 80 different libraries and ass loads of useless header files and layers of abstraction.
OR OR OR you can just use JAVA and have a tested working product out faster.
boost::asio for networking + events, boost::treads for threading, and boost::interprocess for shared memory & other stuff...
It's mostly because they aren't answering the OP's question, and aren't contributing any useful information to the discussion. Compare the posts above with the following:
From what I've heard, one of the best cross-platform libraries for C++ is QT, (originally developed by Trolltech, now by Nokia). It's available either open source (LGPL) or commercially, and while best known for its UI toolkit also provides an extensive library of other functions. Wikipedia has a long list of things it has been used for, and other information.
On the other hand, if you're not too wedded to C++ specifically, Java, C#, or Python might be good alternatives. Syntax-wise, C# and Java are extremely similar to C++, and all three have extensive libraries (built in) that provide the functionality you're looking for. They're also cross-platform (with C# you'd need to stick with stuff Mono can do, but that's still pretty extensive) and you don't even need to re-compile. Speed-wise, both Java and C# are nearly as fast as native code for most applications today, as are certain Python run-time environments. If you need explicit memory management for something, you can even do that with C# (although at that point it may be better to stick with C++).
There's no place I could be, since I've found Serenity...
That handles all the things you mentioned, and you can compile pretty much all the same code natively on Linux or using Cygwin on Windows without having to bother with #ifdeffery at all.
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.
You say that you're writing a lot of "C-like" embedded C++. Are you doing fully OOP style coding and using 'new' and 'delete'? Or are you mostly taking advantage of conveniences like namespaces, scoped variable declarations, etc?
If your code is really more C-ish, you could take a look at the Apache Portable Runtime (http://apr.apache.org/). The APR is the library that Apache httpd is based on; they cover most system-level utilities (sockets, files, etc) you could need in a portable way. The APR is more 'C-like' in that a file descriptor is an opaque handle which you pass in to functions like apr_file_puts(), etc., rather than doing the C++ thing of file->puts()..
But if you're ok with the syntax, it's Apache licensed (corporation friendly), well tested (httpd is pretty ubiquitous after all) and actively maintained.
Not sure how I managed to break the link so badly, sorry.
http://mono-project.org/
Time to go eat something.
Yes, QT is really excellent, but it's worth it to look at Boost as well.
Want a database? Why use Berkeley when there's SQLite?
Portable sockets? QT and Boost both have them.
Portable file ops? QT and Boost both have them.
Data structures? QT has a bunch, but STL is what you should learn.
Windowing lib? QT works on both Windows and Linux. You may be tempted to use WXWidgets, but don't. Despite the fan boyz, you'll find that library to be buggy as shit, and impossible to debug. Sorry, that'll probably get me marked as a troll, but it's true.
And QT on Windows comes WITH the MinGW compiler for Windows package. You don't need to use any other tool than gcc on Linux, Mac, or Windows.
Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
SQLite dominates discussions of embedded databases these days, but Berkeley DB still has fans who don't need SQL. There are a lot of comparisons on the web.
Check out C++ Sockets Library. Does Sockets and Threads.
http://www.alhem.net/Sockets
*ducks*
If you are looking to do a gui like project, SDL does windowing, input, imaging, audio, threading, all in its own little abstraction. It works on Windows, Linux, and Mac all the same.
Duh, Qt!
I have no experience with it, but could this be easily achieved with normal POSIX on Linux and Microsoft's POSIX subsystem (separate download AFAIK) on Windows?
http://dclib.sourceforge.net/, I like it a lot and it has nearly everything what you asked for. In a cross-platform way. I use it on windows, linux and Mac OSX.
And even more, it has a very helpful admin who keeps the code clean and well documented.
Really, no mention of wxWidgets yet? Personally it's what I use for most any old project. Its API is similar to Java's, and it has been LGPL'd much longer than QT, which is why I started using it in lieu of QT. It also has bindings for Python and a half-dozen other languages.
If you've been write multi-platform code using the preprocessor, you don't know what the hell you are doing. Don't blame the tools, learn how it's support to be done. Hint: define a proper build system that doesn't require any preprocessing.
I would suggest SDL (SDL_Net,...)
I'm not sure it covers Threads, but it covers Net for sure.
Your project is screaming for Boost.
www.boost.org/doc/libs
1) Portable networking via boost::asio
2) Boost Filesystem
3) Boost Interprocess
4) Boost Thread
Much of what is in the new C++ 0x10 standard comes directly from boost.
If you use boost threads than you will be ready for C++ standard threads and etc.
Boost also has zero licensing restrictions.
It also plays nicely with python, another fine language.
Best of all. It's not java!
We use it extensively in a realtime medical device that includes several single board computers using either Linux or VxWorks.
Yes, with some minor adjustments, most of the libs will compile on newer versions of the VxWorks toolchain.
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.
Try Mono http://www.mono-project.com/
The Java repliers are right on the mark. Trying to use app-independent portability layers ensures apps of any complexity will suck. By "suck", I mean "compromised at every turn by lowest-common denominator design decisions". Your app will end up using threads on an O/S designed to make multi-processing beautiful (Linux), or end up using multiple processes on an O/S designed to make multi-threading beautiful (Windows). It'll be clueless about the nifty GUI features that exist on a Mac but not Windows, and vice versa. Knowing up front that your app is going to suck allows you to, in all good conscience, choose a language that highly adapted for creating apps that suck in this manner. When I fire up a Java app on Windows (and I ALWAYS know it's a Java app the minute it finally manages to lumber onto the screen), I know I'm going to get the same sucky behavior if I fire that app up on a totally different platform (well, assuming I can manage to figure out whatever obscure infinite-megabyte downloads are needed to get the right "runtime engine" for the given app). Really, the only way you can make your app suck even more and be even more portable is to just go ahead and make it a web "service". That has the added advantage that nobody really expects anything but poor performance and clunky UI design from the get-go. But if for some reason you can't have your app suck as bad as a web service, then Java is definitely the next-suckiest way to achieve that portability that your end users don't give a crap about, but you hope will make your life easier.
...are ones with which I have the most experience. WxWidgets IMHO is the best 'close-to-the-metal' API, with the most available constructs to allow me to implement in C/C++ the Perl prototypes I develop. But most recently I've been noodling with Java to develop a high-availability platform, and I regularly run multiple jvms in Windows command shells to build stuff out, and then take the classes unchanged to a ttylinux-SunJRE-based cluster I run with VirtualBox.
I'm not a Java advocate by any means, but you can't ignore the portability...
GP was being sarcastic?
And maybe a little (more than a little?) critical of AJAX, et. al.?
Maybe?
Computer memory is just fancy paper, CPUs just fancy pens with fancy erasers; the 'net is just a fancy backyard fence.
Have a look at JUCE: http://www.rawmaterialsoftware.com/juce/
You beat me to the suggestion.
SQLite is a very powerful SQL database engine that is highly powerful and comes in a single < 500K library. No server needed.
Interfaces to it exist for most modern languages.
Documentation for the C/C++ API is here
A more C++ friendly wrapper for SQLite is on CodeProject
Is that the name of some kind of portable library?
Computer memory is just fancy paper, CPUs just fancy pens with fancy erasers; the 'net is just a fancy backyard fence.
Go with BloCxx and SQLite.
http://blocxx.sf.net/
C++ Boost is now the 'defacto standard C++ library' as far as I am concerned.
Qt is the default UI and possibly Database access library for C++
They do work together. You use Boost for everything, you can, if it is not there you use
Qt, and if it is not in Qt you will have to find it open source.
The only 'cross-dependency' you need to know is that for Boost if you need to use boost:::signals,
use the signals2.
Also, use boost::shared_ptr as it is now a standard 'reference counted garbage collector' for C++
(it is also in C++ standard tr1).
For the build environment you use CMake (it generates automatically project files
for Visual Studio, Qt Designer, CodeBlocks, standard make files, etc)
and as far as distributed communications (that is passing classes as 'messages')
there is no 'standard' unfortunately.
But OmniORB is exceptional (and interoperates with built in Java ORB if you need to).
C++ is an exceptionally powerfull and expressive programming language, that allows
to express Algorithms in separate libraries without tying them to a data-structure in a type-safe
manner (meaning that if a developer initializes the library algorithm incorrectly he will get a compile-time
error).
C++ however is missing one key language feature that makes it less than desireable if you MUST
serialize your in-memory data between your program invocation (which is why it is not used widely
for stateless session management in web development).
That key feature is 'Reflection' (or also called Introspection) -- without it it is very time consuming to serialize your in memory data into a file or database.
(disclaimer: I'm the author of this lib). LibNUI supports iPhone, Win32, Win64, MacOSX and Linux. It offers complete OS abstraction for Threads, Windowing, Unicode Strings, OpenGL / GLES / Direct3D GUIs and many widgets. You can use it in any GPL application or buy a commercial license. Check it out: http://libnui.net/
1. Implement C++ in Python
2. Use Python libraries for whatever platform independant stuff you need
3. ???
4. Profit!
Boost is a good point to start and a good academic tool for the purists. ACE is trying to be too much for too many platforms. For real world use I ended up with Poco http://pocoproject.org/, very good performance, works flawless on Win/Linux platforms (base on my experience) and has an easy to use interface.
It's more for creative purposes. Does anyone else use this?
http://www.openframeworks.cc/
dito.
-><- no
There is a very stable C++ IDE in Ultimate++.
Quoting from the site:
"U++ is a C++ cross-platform rapid application development framework focused on programmers productivity. It includes a set of libraries (GUI, SQL, etc..), and an integrated development environment.
...
TheIDE can work with GCC, MinGW and Visual C++ 9.0 as contained in free Windows Vista SDK and contains a full featured debugger. TheIDE can also be used to develop non-U++ applications."
time time everywhere and not a second to spare
Apache Portable Runtime
http://apr.apache.org/
NSPR (Netscape Portable Runtime)
http://www.mozilla.org/projects/nspr/
Apache Portable Runtime
Netscape Portable Runtime
And a rock solid but simple embedded database to emulate flash memory.
This part I don't understand... flash is a hardware solution to persistant storage. An embedded database is a software solution to structured storage of data. The two are completely orthogonal.
Ignoring the flash part, I have used sqlite on several embedded projects (set top boxes) and it has done the job. Depends on your requirements though - is the priority speed, space, ease of use/API, etc?
You must try Freepascal/Lazarus, http://www.freepascal.org , http://www.lazarus.freepascal.org
It is not C, but it is a well designed object oriented language/compiler. Also, you can use sqlite, or xml based database.
How about a platform-independent programming language complete with systems programming features, garbage collection, object-inheritance, type-safety and a way to bypass it when necessary? Have a look at Modula 3 and its libraries: http://en.wikipedia.org/wiki/Modula-3
I have used ACE for a number of years. It contains a lot of design patterns that makes coding network based applications that much easier. I use ACE in conjunction with Boost; they complement each other fairly well. For example, I prefer to use ACE's threading constructs, but use Boost's shared_ptrs. We have also used sqlite a bit; it is a great, fast, embedded database that has a very small footprint. I haven't used Qt much, it has just recently become free for use for commercial apps; the projects I were on were cheap... I will have to say though, ACE's documentation is pretty terrible. I usually generate Doxygen documentation with linkable source code to see what ACE is doing under the covers.
Obviously there are not a lot experienced embed heads reading slash. Java:( If you don't like ifdef this or that try Java. Instead of ifdef, Java programmers us xml in what I call program by configuration file. It adds an entirely new dimension to programming that most skilled programmers would never have thought of. It is even more delightful when they use multiple overrides on their configurations files and you have to hunt through multiple files to to see how things are configured. Not only that, they can actually change the way code executes with configuration files. So not only do you have to look at code to see execution paths, you have to dig through multiple configuration files. It is truly the strangest methodology I have ever encountered. Stick with a C or C++ library. QT works well. For key value searchers Berkeley has no peer but SQLite works ell if you are into SQL.
wxWidgets emLib http://larytet.sourceforge.net/ are two options I used. emLib is available in LGPL - contact the author.
If you need a graphical user interface in your application go for Qt. Seriously, you won't regret it. I'm also using several other open source libs like Boost, but those won't help a bit to get your cross-platform GUI running. Qt, in contrast, handles that great, and has IPC, SQLite integration and thread abstractions a bonus. Besides, if you are starting as a "fresh" user , you will have benefit that once you have learned a bit Qt you will be comfortable with the other classes in the library as well. In contrast, if you decide to go for different lib for each purpose, you will have a lot more to learn (and to integrate).
I've used ACE a lot, 10 years ago, even then the code looked like it'd been hacked on by 4 generations of under-grads (which it had). Basic stuff works good, but there are some lurking race conditions in shared memory pools that you don't want to meet. I recommend Poco, industrial, easy-to-use etc.
http://pocoproject.org/
I wouldn't consider boost, yet, they're just starting to put in a full suite of cross-platform stuff and they're still missing some important pieces.
See http://pocoproject.org/. It's built on top of boost, and is in modern c++ style. That includes
database bindings for sqlite and others.
Boost is an absolutely incredible library, and any C++ programmer who doesn't use it is probably missing out. That being said, if you know ACE (i.e. have made it past the pretty steep learning curve) then ACE gives you more options. Boost's thread library is pretty great, but they simply don't have as fine control over primitives. There are also many things that you can do in ACE that you simply can't do in boost easily -- such as non-static pooled allocators.
Unless I am completely missing something, there is also no equivalent to the TAO in Boost.
I work on performance critical C++ code (yes, there really is such a thing) and we pretty much use ACE for anything involving IPC, sockets, or Threading -- and boost for everything else. That being said, the boost ASIO, thread, IPC, and Intrusive libraries are so easy to use compared to their ACE counterparts that unless performance is critical or boost simply isn't enough -- there isn't much use in learning ACE from scratch.
Well, if you need a database abstraction layer - Poco is pretty good for embedded platforms (http://pocoproject.org/). It'll allow you to swap between odbc and sqlite connections out of the box - it's also pretty easy to extend. Poco is heavily targeted towards writing generic (non-ui) applications for Windows/Unix. It's also got abstractions for Filesystems, Network, Threading, and Application factories. It's not perfect, though -- we had some issues with Poco's containers not properly handling const template parameters, so eventually pulled in boost. We've found everything is pretty harmonious if we use boost when we can and Poco for the places where boost is lacking (ie DB abstractions, etc).
Try POCO. I've found it to be pretty useful.
And it has zlib license, so you can do anything with it.
Disclaimer: I have nothing to do with the library development, just a user.
Java, or link to the Cygwin library. The latter gives you a kind of POSIX API wrapper for your windows applications. So you can use POSIX threads and IPC stuff if you want. I'm not sure how efficient that is though, or how stable the general Cygwin API is.
Yes, that's it. Roll your own.
Sockets are pretty much the same (salve the SOCKET type is in fact an int in POSIX land). Threads and IPC are not that different, either. Stick to what you actually need, and KISS (keep it simple). All in all, a week of work (I know because I have done it).
By the way, just avoid littering your code with #ifdef. Put one in the header file and define common types, then try to use exactly the same code everywhere. Only put #ifdefs in the code if there's no other way.
As a side effect, you will become a kick-ass threads and sockets programmer.
If you find boost or Qt too heavy, you might want to check POCO libraries
Qt and SQLite. Seriously. LGPL and kick-ass! Also, Qt can be compiled to have SQLite completely built-in. No extra libs/dlls needed. It handles networking, threading, IPC, SQL and much more. No need for platform-specific ifdefs.
My other account has a 3-digit UID.
The database you are after is surely SQLite -check out (sqlite.org).
As far as portable C++, you probably want to check out QT. Not sure about IPC, but QT these days comes with much more than GUI, includes threading, networking, SQLite and plenty more.
QT is simple, intuitive, portable and available under GPL.
For really early adopters, C++0x includes built in threading support. You'll still have to use libs for sockets though.
The obvious answer would be QT, imho.
openKode (http://www.khronos.org/openkode/) from khronos group
the core component is the OS abstraction
my company works on many different platform and we are pushing each vendor to write this component. for those who don't we do it ourselves.
Qt allows my applications (database driven for example) to work in Linux, Windows and Mac OS. The translation system is superb and easy to use. I can not talk about, for example, OpenGL from Qt because I've not used it.
Hi, I have tried different socket libraries for Windows and Linux applications. SharkEngine is a free C++ library for network, file and multi threading support. There are also higher level protocol classes so you don't need to reinvent HTTP and SMTP for example. Otherwise QT and Boost are obviously good choices, then there is "Alhem's C++ Sockets Library". I never used ACE, the documentation is confusing and I think John Snader warns in his TCP/IP Programming book about it. Here is a list with contenders:
* SharkEngine http://www.pichat.net/documentation/pichat_sdk_sharkengine
* QT http://doc.trolltech.com/2.3/network.html
* Boost http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio.html
* Alhem http://www.alhem.net/Sockets/
When it comes to small databases I know only SQLite, which is programmed in C and more powerfull than Berkeley-DB. See http://www.sqlite.org./
Definatly take a look at poco project http://pocoproject.org/ It seems to covera lot of what you want
I think modding people Troll is the /. equivalent of smacking dogs on the nose with a rolled up newspaper when they defecate in the apartment. I.e. it's just a way to stop them doing it again. Clearly no one wants to read "Why not use Java?!" in these sorts of discussions. Now you can't explain to a dog why indoor defecation is bad, just like you can't explain to Java programmers why Java is just a bad idea. Still shit in the apartment and posts advocating Java is not something which you need to tolerate.
echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
Always use boost if they have a library that does what you want. Not only because it does what you want and is portable but also because boost is well maintained, updated frequently, the code quality is top notch and the boost libraries share a common approach to doing things which makes it easier to learn (you will probably learn a thing or two about using modern C++ yourself if you use them). In other words, boost rocks. There is also a high probability that it will eventually be incorporated in the C++ standard library.
Glib + Gtk++ is pretty decent. You also have Gnome Db for database access. A number of people have suggested QT and also WxWidgets. Both are pretty good.
the C++ GTK+ interface is great...deploying GUIs is really easy, swing/awt like...
Plus you have very good STL support and a lot threading/files/io cross platform support.
And it's proper C++!
Cheers,
I've been using wxWidgets for 4 or 5 years now for our company's commercial product and find it quite stable, and I use almost every aspect of it. Also, it works just fine with GCC on my Linux box and my Snow Leopard machine.
Not to be too critical, but do window libraries really have "fan boyz" :) If so, then I guess I am one of them.
"" Now, I am about to start a project emulating embedded hardware on Windows ""
since you're already in hell, you can as well go with perl.
---
flame me all you want, this guy is doomed already
So yes. Here's just a quick +1 on Boost and Qt.
Jag pratar lite svenska.
If you want what looks like a promissing web interface you might try http://www.webtoolkit.eu/wt. Life's beautiful when you can do web stuff in just one language
-- Many men would appreciate a woman's mind more if they could fondle it
Why use mono on windows when you can just run it against M$ .NET Framework?
Or maybe not, Qt, Boost seem good choices based on your experience, but it really depends. The best hw emulators (and simulators) I have seen / done / supported were written in LISP, yes, not new nor trendy.
And there is of course Erlang, it has all in language, is natively threaded even between nodes if desired, has very good database(s) natively, and so on - but not new nor trendy. Much less coding, configuration, etc effort than in most languages but maybe needs some time to get used.
Try BerkeleyDB with libstldb4 (a bit incomplete perhaps (binary support isn't great yet), but pretty good) and ASIO (Boost or non-Boost version). There's a lot more to writing platform-independent programs than any library or language is going to do for you, though.
I once killed a man right at his keyboard for claiming a segfault in the QT library. This is serious stuff.
Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
As an addition to the already mentioned, there is also a commercial grade that might be easier to use than Boost. SourcePro C++, you can check it out at http://www.roguewave.com/products/sourcepro/.
You say you're "emulating embedded hardware on Windows". What will you use the platform independence for? If you don't need it right now but "maybe in the future", I suggest skipping it. Write for Windows, but make sure ask the compiler to accept ISO C++ only, and don't sprinkle Windows-specific crud (UWORD, __declspec and whatever they are called) in the parts of the code which *are* platform-independent.
An unused portability layer only weakens your code.
Personally, I couldn't care less for Windows, so I develop under Linux and target Unix in general (not actively, but I expect it to be easy to port to some other decent Unix if I have reason to in the future). It's great -- I can use select(2), fork(2) and treat file descriptors and sockets alike. And I can learn from good books (e.g. Stevens) and discuss it with people who have been using those interfaces since, well, forever. No portability layers have that much support.
By the way, I don't see why you need a bloody *database* (even a nice one like BerkleyDB) to emulate flash memory. Can't you just mmap() a file?
I also come from an embedded background and I didn't find a C++ platform abstraction library to my liking (i.e. fun to use and giving the programmer maximum power and control), so I went off and wrote my own: http://www.nedprod.com/TnFOX/ (docs are at http://tnfox.sourceforge.net/TnFOX-svn/html/). You can build a noGUI version which leaves out all the GUI stuff which should provide what you want: it also has a type reflecting metaprogramming database adapter with a copy of SQLite3 thrown in for good measure, and it is very seriously fast and efficient unlike most GUI toolkits e.g. all the bottlenecks use assembler or intrinsics and there is ample stream computing support which uses metaprogramming to assemble vector instructions. One major difference from libraries such as ACE is that I deliberately made TnFOX as fun to program in as possible - I have made zero attempt to make it academically "proper" or "pure".
Hence it does come with an unusual programming paradigm - I make heavy use of C++ metaprogramming constructs and C++ exception handling and pervasive multithreading. And almost no one else uses it which I take it to mean that its learning curve simply isn't worth it for most people which is fair enough. In the end, if you ever want someone else to be able to work on your project then you need to use a well established toolkit which has a significant programmer pool attached to it. And ease of finding programmers is vastly more important than a "right" or "proper" or even "good" programming paradigm - as the designers of Plan 9, BeOS and NeXT found out.
If your project is something recreational, do give TnFOX a look. If it's for something ever destined for outside your personal fun time, go with Qt or wxWindows or any big free portability library.
HTH,
Niall
In general, you'll be better off asking such questions on StackOverflow - you'll get an answer within minutes without having to wait for it to be posted. In fact, you wouldn't even have to ask - this is one of those question that's asked so frequently that there are plenty answers on various aspects of it.
The short answer is: if you need UI and/or are familiar with Java, use Qt. If you don't need UI or you really like idiomatic C++ (think STL), use Boost.
* ACE: Good for network heavy work. But you do not have to use the whole thing. Just go for the lower layers. i.e. ACE_OS is a static layer that provides a very thin wrapper around native calls. One step up, and you're working with Socket and Thread objects build on top of that, which is also great. However you might not want to get into the Reactor Proactor, Acceptor Connector pieces if you are building something small and lightweight, and you don't have a team to maintain it.
* WxWindows: Decent for cross platform applications but careful about subtle behavior differences (e.g. recursive locks suddenly become non-recursive on the other platform. might be fixed by now though.). Though I havent seen it used in industrial strength server projects, as ACE is commonly used. From what I remember the cross platform GUI pieces are fast and clean though.
* BerkelyDB: I dont know enough about what operations you need in your emulator to comment.
Stay away from it. On the surface, it looks quite attractive, and can do things that Cygwin can't (like 64-bit apps), but the reality is different. This is a piece of software that MS has bought from a third party a while ago, for reasons unknown, but doesn't want to spend resources on anymore. We've tried using it on a fairly large C/C++ project, and found quite a few bugs, some of them being rather bad. Trying to get those bugs fixed is a major pain, even with a support contract, and our attempts to escalate have been fruitless.
Take a look at Poco (pocoproject.org).
Microsoft Visual Studio's C++ compiler has an option that lets you generate 100% CLR binaries that will run on Mac and Linux with mono. The limitation is that you can only use the .Net API.
No, I will not work for your startup