B
_BNC
I have an old C DLL that I want to access via C#.
I'm doing this via an outer DLL that wraps the old C DLL in an unmanaged
C++ class, which is in turn wrapped in a Managed C++ class. Both these
unmanaged C++ and managed C++ classes are compiled into a single assembly
(DLL) that is accessed by C#.
[C DLL] <--> [Unmanaged C++ / Managed C++] <--> [C# app]
old dll new C++ assembly app
I don't want to use standard Interop methods. I'm trying to do all the
direct access to the old C DLL with unmanaged C++. The data types in the
old C DLL are relatively complex, so I'm encapsulating the cluttered
legacy stuff in the new unmanaged C++ class.
IOW, I'll usually only be passing ints and a couple strings between the
unmanaged and managed sides.
In general, this approach works, but I'm getting occasional runtime errors
that I can't explain. Could someone post or refer me to a very simple
example that does this with even a single function? Say, take a function
from a stock Windows DLL and show a correct unmanaged C++ class
and managed C++ class that will wrap it correctly.
Thanks for any insights you can provide.
I'm doing this via an outer DLL that wraps the old C DLL in an unmanaged
C++ class, which is in turn wrapped in a Managed C++ class. Both these
unmanaged C++ and managed C++ classes are compiled into a single assembly
(DLL) that is accessed by C#.
[C DLL] <--> [Unmanaged C++ / Managed C++] <--> [C# app]
old dll new C++ assembly app
I don't want to use standard Interop methods. I'm trying to do all the
direct access to the old C DLL with unmanaged C++. The data types in the
old C DLL are relatively complex, so I'm encapsulating the cluttered
legacy stuff in the new unmanaged C++ class.
IOW, I'll usually only be passing ints and a couple strings between the
unmanaged and managed sides.
In general, this approach works, but I'm getting occasional runtime errors
that I can't explain. Could someone post or refer me to a very simple
example that does this with even a single function? Say, take a function
from a stock Windows DLL and show a correct unmanaged C++ class
and managed C++ class that will wrap it correctly.
Thanks for any insights you can provide.