Using C++ header in C#

I wish to know the possible way for me to use the C++ header, in this case the ogr/gdal header in C#.
I am currently trying to 'turn' all the header into .dll file and using dllImport in C#. However, I find no way to import classes, which to be used to create object to store dataset. Is it a fine way converting to .dll in order to achieve what i want?
On the other hand, I found out from msdn about unmanaged/managed code. I have seen the migration guide provided in msdn, but I can hardly understand the meaning from it. Does anyone knows a better example for doing migration?
Anyhow, I am very glad if someone has a better solution to make it works.
Thanks a million in advance.
regrads,
Pin.
[735 byte] By [teapeng] at [2007-12-16]
# 1
What information in the header are you interested in?

Most of it will not be accessible to you. #define and prototypes will not be useful.

DllImport is primarily used to import functions, but you need to know the signature. There isn't an easy way to get them.

DanVallejo at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
Thanks for responding to my question. In this case, the header I intrested would be the OGR/GDAL header that I wish to use for my GIS research. Below is part of the class declared in the "ogrsf_frmts.h". I know some simple dll creation with function. However, this header seems to has classes and complex function which confused me a lot. I am sorry if this header confuse you, but I do need a way on how to convert this piece of header so that I can use in my C# program. However, if you have a better solution to use C++ header in C# would be much welcome. Once again, thanks a million in advance on helping me.Smile
class CPL_DLL OGRDataSource
{
public:
OGRDataSource();
virtual ~OGRDataSource();
static void DestroyDataSource( OGRDataSource * );
virtual const char *GetName() = 0;
virtual int GetLayerCount() = 0;
virtual OGRLayer *GetLayer(int) = 0;
virtual OGRLayer *GetLayerByName(const char *);
virtual OGRErr DeleteLayer(int);
virtual int TestCapability( const char * ) = 0;
virtual OGRLayer *CreateLayer( const char *pszName,
OGRSpatialReference *poSpatialRef = NULL,
OGRwkbGeometryType eGType = wkbUnknown,
char ** papszOptions = NULL );
virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer,
const char *pszNewName,
char **papszOptions = NULL );
OGRStyleTable *GetStyleTable(){return m_poStyleTable;}
virtual OGRLayer * ExecuteSQL( const char *pszStatement,
OGRGeometry *poSpatialFilter,
const char *pszDialect );
virtual void ReleaseResultSet( OGRLayer * poResultsSet );
virtual OGRErr SyncToDisk();
int Reference();
int Dereference();
int GetRefCount() const;
int GetSummaryRefCount() const;
OGRErr Release();
protected:
OGRErr ProcessSQLCreateIndex( const char * );
OGRErr ProcessSQLDropIndex( const char * );
OGRStyleTable *m_poStyleTable;
int m_nRefCount;
};
teapeng at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified