Discussion:
Wrapping a traditional dll in C#
(too old to reply)
DanielP
16 years ago
Permalink
All,
I am trying to wrap a traditional C++ dll, that I don't have the source for, in C#. I do have the header files listing what's exposed. The dll accesses a DB and provides access to the data. The problem I have is that the data is strored in a class and not a struct. As a result, some of the functions have pointers to classes as parameters. Does anyone know how to handle this on the c# side.
C++:
BOOL get_record(LPCSTR ap_id,CRecord *pRec,BOOL anyways = FALSE);

class DllExport CRecord : public CDBRecord
{
}

Thanks in advance for any and all help

From http://www.developmentnow.com/g/21_0_0_0_0_0/dotnet-framework-interop.ht

Posted via DevelopmentNow.com Group
http://www.developmentnow.com/g/
Eusebiu
16 years ago
Permalink
Hello....
Check out the Activator class and it's static methods: CreateInstance,
CreateComInstanceFrom.

You can get dynamically the type of that OCX(COM Object) using
Type.GetTypeFromCLSID if you know the CLSID or Type.GetTypeFromProgID if you
know the ProgID.

Hope it helps...
Eusebiu
16 years ago
Permalink
Hello....
Check out the Activator class and it's static methods: CreateInstance,
CreateComInstanceFrom.

You can get dynamically the type of that OCX(COM Object) using
Type.GetTypeFromCLSID if you know the CLSID or Type.GetTypeFromProgID if you
know the ProgID.

Hope it helps...
Eusebiu
16 years ago
Permalink
Hello...
The first two posts were for other post.. sorry for that...

To answer (in my opinion) you question, you can use marshaling to create
IntPtr pointers and then copy the data inside the allocated memory. For this
you could use Marshall class.

Hope it helps... and sorry again....
...
Loading...