I am using JNAerator to parse the windows API header files so I can reference them from the JVM. However I am not as comfortable with C/C++ as I am other languages, but I need to understand these header files before I can parse them correctly.
I am looking at Unkwn.h in particular and it basically contains
#include "rpc.h"
#include "rpcndr.h"
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
//Some forward declarations
typedef interface IUnknown IUnknown;
typedef interface AsyncIUnknown AsyncIUnknown;
typedef interface IClassFactory IClassFactory;
#include "wtypes.h"
//followed by the full declarations for the interfaces IUnkown, AsyncIUnkown and IClassFactory and their methods, but no actual implementations of course.
I would think these forward definitions would be needed if the types (IUnkown,AsynIUnkown or IClassFactory) are referenced by wtypes.h, but I cannot find any references to those types in wtypes.h or the other headers that wtypes.h references. So why are the forward declarations needed (or did I miss something)?
These aren’t forward declarations. These are type definitions, and they define interface datatypes. This is a Microsoft extension of course. What the definitions do is making sure that
IUnknown(for example) refers to an interface of that name.