Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Improve this question
I am considering using COM interfaces within an embedded (non-Windows) system that has a limited C++ compiler, and I am looking for an open-source COM implementation using simple C++, in particular with little or no use of templates and without use of exceptions (yes I know COM doesn't use exceptions but an implementation could use them internally).
At this point I'm mainly looking for C++ definitions of all the core COM types i.e. IUnknown, IDispatch, VARIANT etc. plus some helper classes for smart pointers, BSTRs etc. Some level of support for implementing QueryInterface and IDispatch might be nice but I can also do that myself. I'd like to find an ITypeInfo implementation, and an embedded implementation of DCOM would be attractive.
I know I could use Microsoft's source supplied with Visual Studio but I would rather avoid it because of the complexity of pulling in a lot of definitions that I don't need, plus I want to avoid any possible legal issues with using it on a non-Windows platform. I'm also thoroughly familiar with ATL and I can't use such a heavily templated approach due to compiler limitations. I have a lot of experience with COM and DCOM so I could write all of the definitions and helper classes myself, and I could even write my own DCOM system if needed. But I'd rather use an existing open-source implementation if there is one. Do you have any recommendations?
A few years ago I was considering starting a FOSS implementation of COM/DCOM, but didn't get anywhere, mainly because I didn't think that would be interesting to anyone in the open source community. There is the proprietary implementation by Software AG (called EntireX DCOM), which I assume would not be interesting to you.
As for open source projects, other than Samba and Wine implementations and XPCOM in Mozilla, there is OpenCOM. They have posted their code on SourceForge.
The closest Open Source implementation I am aware of is Mozilla's XPCOM (it's not exactly the same as Microsoft's COM, but is quite similar). But I am not sure if it's still possible to build it standalone as the instructions provided are quite outdated now.
I would suggest looking at Wine. Source code is in C, not C++, thus avoiding any and all issues with full C++ support, C++ templates, etc. Wine also has implementations for many (most?) of the standard interfaces.
For example, source code to LoadTypeLib (which returns an ITypeInfo implementation) is in dlls/oleaut32/typelib.c:383. ITypeInfo::AddressOfMember is at typelib.c:6742 (in ITypeInfo_fnAddressOfMember).
(It is somewhat odd to see COM implemented in C, but COM defines a binary standard precisely for this reason, so that COM components can be implemented in any language without placing restrictions on the consuming language...)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Visual Studio is capable of reporting errors and warnings "as you type" in the Error List View;
Is there any C++ IDE for Linux capable of behaving as Visual Studio does (With the same level of speed/accuracy)?
This boosts the speed of the development drastically.
If you know IntelliSense in the C# IDE then you're not too far from a C++ IDE that implements this, the Visual C++ IDE does this as well. Modeling this feature as a JIT compiler isn't very accurate, it is simply the front-end of a C++ compiler. Minus the back-end, the code generator, that doesn't happen until you actually build the project.
Sounds simple, it is nonetheless a pretty non-trivial thing to do well. Primary implementation problems are doing it fast enough, in the background while the programmer is typing. And dealing with code that is almost always in an uncompilable state since the programmer is busy editing. Common front-ends in regular C++ compilers are not typically fit for that job. They are not fast enough and don't particularly deal with uncompilable code all that well, often generating a flurry of additional uninteresting errors that were induced by a single mistake.
Microsoft used to use their own parser to do this but gave up on it. The Edison Design Group are the specialists in this kind of tooling, famous for one for being the only ones that ever created a C++ compiler that completely implemented the C++03 language specification. EDG just sells the front-end, they leave the back-end to the implementer. VS2010 was the first VS version that started using EDG's. Not entirely trouble-free btw, in a few corner cases the EDG parser disagrees with the Visual C++ compiler.
This feature is not otherwise widely available. It is just plain expensive and hard to maintain, especially with the rapid changes in C++ as of late. Last I heard (been a while), EDG asks you to plunk down $50,000 before they even start talking to you, there probably is a royalty payment involved as well. It surely costs Microsoft a wholeheckofalot more, they also need to support the C++/CLI and C++/CX language extensions. Well, that's what you're paying for.
KDevelop, QtCreator, XCode and many other editors offer this feature. And more will come, as nowadays it's rather trivial to implement in some way based on Clang.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Improve this question
I'm planning on developing mobile application for both iOS and Android and I want to use C++ for the development.
Which cross-platform framework is available for building mobile application using the C++ language.
I'm sure a lot of people have this question as well, so read this if you'd really like to know the answer. Marmalade is probably the BEST solution. Code once, deploy to mobile devices, desktops, even some TV's. Many popular games have been created with Marmalade.
Extensive games like:
Lara Croft and the Guardian of Light
Call of Duty: World at War Zombies
But also simple games like:
draw something.
Doodle Jump
They've added a free package. You can create your game for free and if you want to get rid of the ad splash screen, it's $150,- per year for mobile devices or $500,- per year for other devices as well.
A big advantage is the native speed. It doesn't matter what people claim about other languages like javascript or java (and unfortunately Qt, which of course isn't a language but you know what I mean) running as fast as C or C++. It's simply not true. For simple applications this is of course not important, but when you're looking at (simple) games, this is crucial.
At the moment version 7.3 is available, but this version has a problem with the ARM emulator. I would download 7.0.
Whether you choose Marmalade or not, make sure you read the documentation. You don't want to end up missing some functionality and switch to another option when you're almost finished.
I've looked into portable code between Android and iOS before and I don't think it's possible.
To release apps into the Android market it needs to be in Java, and anything with a GUI on iOS needs to use Objective-C.
You might be able to have partial portable C++ layer, but in reality it's probably quicker to write the same app twice in Java and Obj-C than it would be to write it once in C++ as a portable solution.
Qt or Wx-Widgets might have some support, but I have not looked into mobile platforms for these, and I suspect the reality is that Apple, Microsoft and Oracle want you to be tied into their technologies these days and have no incentive to make things portable.
C# and Java provide a complete framework that allows code to be written much quicker using well documented classes and libraries, especially when dealing with user interfaces.
C++ on the other hand relies on many open source projects that take a lot of effort to get functioning on multiple platforms, and much time is spent dealing with subtle platform problems.
My suggestion was simply that it might be easier to pick a language better suited to the platform you are dealing with, as C++ tends to be lower level than other languages, the syntax can seem verbose and many hours can be wasted trying to make things work that you would expect to just work, and unfortunately documentation for many open source projects is poor.
Maybe this can be considered to be an opinion, but then the shift from C++ to C# or Java commercially might also indicate that I'm not the only one believing this.
You can take a look on openFrameworks, maybe it fits on your needs:
http://openframeworks.cc/about/
There ARE solutions for C++ cross-platform development for Android and iPhone, despite what other answers say here.
The best is probably Marmalade, but it's expensive, so only useful for commercially viable apps: https://www.madewithmarmalade.com/
Then there's MoSync, which you can use for free. Unfortunately they went bankrupt last year, so there's no ongoing support. Still, might be worth a look depending on your needs. http://www.mosync.com
OpenFrameworks is one I hadn't seen, so thanks Rodrigo for that answer: http://openframeworks.cc/
There is no cross platform solution using C++, unless you're interested in making games. There are a few options available if you don't mind using another programming language. Take a look at Titanium SDK (Javascript), Xamarin (C#) or the multitude of HTML5/CSS/Javascript frameworks (Phonegap comes to mind).
Look for the DragonFire SDK it allows you to write apps and games in c/c++. Not cross-platform and never used it but looks good. It uses Visual Studio and has its own simulator for iOS development.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I like to try out many different programming languages but I can never really use many of them in real projects because all important libraries that I need are written in C++.
Usually I have to write a C-Interface which can be pretty time consuming, so I am wondering does a programming language exist that can seamlessly call any C++ code?
Many functions in C++ are defined in header files, and expected to be compiled into every application using them. It occasionally happens for C too, but for C++ it is far more common, particularly as class members for templated classes cannot be made available in advance for every potential template instantiation: there are infinitely many.
If compatibility with C++ requires a complete C++ parser and compiler, you've not really got a different language, you've got C++ with extensions. Even if one of those extensions is to make parts of the code look nothing like C++, it adds massive complexity for little benefit.
If you don't need complete and seamless compatibility with C++, then limited compatibility is available in some languages. There is D's Interfacing to C++, describing what works, what doesn't, and why not.
There is an experimental language that can do so, but there's only one developer (myself) and it's in such an early stage of development that it's not useful right now.
Here's a simple sample program:
Main() {
cpp("iostream").std.cout << "Hello, World!";
}
FTR, compiling this sample requires ADL, OR, template instantiation, ABI compliance, parsing the C++ header in question, and lots of fun stuff.
No language can seamlessly interop with C++. C interfaces are a good idea. It's important not to export all / many functions from the module, because it's time consuming as you noticed. Focus on solving one problem at time and export the function solving this problem to C.
On the other hand, if you really need to expose many functions or even classes to other language, you can use SWIG. Read its documentation and you'll notice how many problems it needs to deal with while creating the wrapping code. That's because any two languages are different and you can't change that. The solution to this problem is to use the greatest common interface of two languages - C.
The only solution that meets your requirements is V8 / Javascript from Google.
Is the only implementation of a scripting language written in C++ that I know of, plus the API themselves are exposed via C++ too .
The downside is that is not a simple project, is not exactly available on any platform, it's being developed according to the Google needs and there are no guidelines or standards, for example C++ is being versioned by ISO documents that are released each time a new milestone is out and each one of them defines the standard, V8 is more like an ongoing project with some big voids, especially in terms of invariances , standardization and concurrency.
For example there is nothing that keeps Google from changing the entire set of APIs from one version to the other, and unless you are counting on a really big team, I doubt that you can keep up with that.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I would like to write my own LDAP client under Linux, specific to our local environment. Most probably I will use QT4 to provide a shiny frontend without much hassle.
I found that there seems to be no standard C++ library for this. OpenLDAP provides a C API and there should also be a C++ API (experimental?) somewhere..
Do I need to use the C stuff or is there a C++ API out there worth of recommendation?
I've actually written a C++ wrapper for OpenLDAP's C API for my day job and it wasn't my most enjoyable experience.
I didn't find a suitable C++ wrapper out there for my purposes (this was in 2006 so things may have changed since). I wound up directly interacting with the C api, which wasn't terrible but it does have some oddities. Assuming you go to the C/OpenLDAP route I can offer you a couple of tips.
Something that I found a little weird, the C API is defined in RFC1823 which means that pretty much every library has the same API.
In the case of OpenLDAP however a number of the RFC1823 API calls have been deprecated, particularly around the authentication parts. Depending on who distributed your OpenLDAP library and what version it is will determine if these deprecated functions have been disabled.
The main changes to avoid the deprecated API are switching from ldap_init() and ldap_open() to ldap_initialize() and using ldap_sasl_bind() (which confusingly handles all types of auth)
I found following c++ wrapper useful. Open Source C++ wrapper
This question is not easy to answer without knowing specifics of libraries you need.
I would say if C++ library based on Qt and available in source code - that'd be the front runner for sure. And if C++ library depends on some other not-Qt framework - don't even try to mix it with Qt.
C-based libraries generally have less dependencies, though a bit awkward and require more attention to details (initialization / deinitialization) comparing to C++ (destructing class usually means releasing all tied to it resources).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have a good understanding of OO from java and C# and I'm lucky in my engineering courses to have been exposed to the evils of both assembler and C (pointers are my playground :D ).
However, I've tried looking into C++ and the thing that gets me is the library code. There are so many nice examples of how to perform the bread and butter tasks in java and C#, but I've not been able to find a good explanation of how to do these things in C++.
I'd love to expand my knowledge into C++ to add to my skillset but I've not had a chance to be exposed to people and communities that are keen on these things.
Could anyone here recommend some good open source projects or tutorials which are useful. Bonus marks if they involve coming from java or C# into this environment.
I'd suggest that you work your way through the excellent Andrew Koenig and Barbara Moo book "Accelerated C++" (sanitised Amazon link). This book teaches you C++ rather than assume that you know C and then look at the C++ bits bolted on.
In fact, you dive in and are using STL containers in the early chapters.
Highly recommended.
As well as the other answers here, I think you should take a look at the QT toolkit. Not only does it have GUI widgets, it also has libraries to work with things like databases, multithreading and sockets.
A combination of BOOST and QT, IMHO, provides you with the tools to address in C++ any problem you might be faced with.
I don't have any such resources for you, unfortunately, as I took the long way of slowly discovering things piece by piece.
I do have a caveat for you, though: keep in mind that in the C++ world, the standard library has been very slow at providing useful services. Basically, you'll find a few algorithms, data structures, a few string-related classes and some basic I/O-related ones. Unlike Java or .Net, there is not an extended library of classes for all kinds of purposes (networking, file system services, cryptography, concurrency, etc) - the closest to that is probably Boost, which looks and feels like an extension to the standard library, but which is still external (although some parts of it are leaking back to the standard library).
It's worth bearing in mind that C++ is primarily a systems programming language. Thus its main emphasis is not on performing bread & butter tasks but on writing the tools that are used to perform those tasks. For example, rather than supplying database access libraries out of the box, C++ is intended to be used for writing the database engine itself.
Assuming you already have some knowledge of the C++ syntax, and have good Object Oriented experience I'd go for Effective c++ series.
It's a collection of "tips and tricks" explaining how c++ works under the hood. Which are the common misunderstandings from people coming from other languages and why c++ works this way.
It depends what platform you are programming on. C++ itself doesn't have the same sort of library that Java or C# have. That sort of functionality is traditionally supplied by the operating system. I suggest you learn C++ from a book (I like C++ Primer by Lippman but it may be a bit slow as its aimed at beginners) and then head to MSDN if you are programming on Windows. There are APIs for networking, XML parsing, encryption, just about everything you need. They are just tied to the OS instead of the language itself.
I don't know the equivalent resources for Linux or the Mac but I'm sure someone can supply them.