Ways to being .cpp and h file types and classes into a third party app

I inherited a series of h and .cpp files that when compiled are brought in to other consuming c++ apps with the regular .h and .lib static library approach. It would be nice to consolidate this work into one or a few files and with less access to the setup of classes and types than what is revealed in .h files. In other words an approach that doesn't require including h files to access the types. So for example one h file defines some structs like

struct type1
{
struct type1a
{

};
};

etc.

Instead of having to include an h file to define the type in a client app, is there any way to bring this in with another approach such as COM or Automation or chaining .libs together? We've tried chaining lib files but types defined in .cpp files aren't recognized in the client app when they're imported. Exported types still require the h file. I would envision such a command as something like one line

import "myobject"

This brings in both the type defs from the h files and any cpp code without requiring an h file. They would be used in the client as though they were defined in an h file with just

MyObject t;
t.run(), etc...

Last edited on
Yes, in fact you just described in detail, exactly what OLE\Automation is for. You'll have to modify the source code so that the features that you want can be accessed from stub files so there is a bit of work to it. Just keep in mind that the real strength in learning this stuff is to expose your C\C++ code to other languages, it is certainly not a time saver.

- http://msdn.microsoft.com/en-us/library/windows/desktop/ms220985(v=vs.85).aspx
Topic archived. No new replies allowed.