> I've had to write a lot of code to interface C# to older Win32 DLLs.
> Basically, an unmanaged C++ class talks directly to the Win32 DLL.
[quoted text clipped - 3 lines]
> Lots of work. Is this simplified in C++/CLI? Any sample code
> anywhere?
In the original version of my code I had two C++ wrappers--unmanaged
and managed. I did my best but it was tedious. From what little I've
read, I should be able to simplify to just one layer of C++ code,
right? In that declarations for managed vs unmanaged data are clear,
I can probably control that inline with handles vs pointers. Not sure
if the calls into the native Win32 DLL are more concise though. I'd
like to avoid using PInvoke, as some of the data types get obscure.
Is this made transparent in 2005beta2?
>What do you mean with simplified? You still have to wrap the native class by
>a managed class and delegate the method calls to their corresponding native
[quoted text clipped - 9 lines]
>> Lots of work. Is this simplified in C++/CLI? Any sample code
>> anywhere?
_R - 25 Sep 2005 06:33 GMT
>In the original version of my code I had two C++ wrappers--unmanaged
>and managed. I did my best but it was tedious. From what little I've
[quoted text clipped - 18 lines]
>>> Lots of work. Is this simplified in C++/CLI? Any sample code
>>> anywhere?
_R - 25 Sep 2005 07:09 GMT
>>What do you mean with simplified? You still have to wrap the native class by
>>a managed class and delegate the method calls to their corresponding native
>>method implementations.
>>
>>Willy.
> In the original version of my code I had two C++ wrappers--unmanaged
> and managed. From what I've read, I should be able to simplify to just
> one layer of C++ code,
PS: I could have stated that more clearly: I had two layers of C++
DLLs *in VS 2003*. I used an unmanaged wrapper to talk to the old
Win32 DLL. That wrapper collected functions into an organized class,
localized data, and generally imposed some structure.
A managed C++ DLL wrapped that unmanaged class so it could be called
easily from C#. Each DLL required different compile switches.
Q: Are there any new features in C++/CLI that would simplify this
process?
Arnaud Debaene - 25 Sep 2005 10:48 GMT
>>> What do you mean with simplified? You still have to wrap the native
>>> class by a managed class and delegate the method calls to their
[quoted text clipped - 16 lines]
> Q: Are there any new features in C++/CLI that would simplify this
> process?
Well, you can certainly fold the 2 C++ DLLs (managed and unmanaged) into 1 :
just have the "organized class, localized data, and generally imposed some
structure" stuff be directly in the managed C++ DLL (MC++ and C++/CLI can
call directly on Win32).
Btw, you could have done the same thing in VS2003, although the syntaxic
clumsiness of MC++ would have made it cumbersome.
Arnaud
MVP - VC
_R - 26 Sep 2005 19:19 GMT
>> I had two layers of C++
>> DLLs *in VS 2003*. I used an unmanaged wrapper to talk to the old
[quoted text clipped - 6 lines]
>> Q: Are there any new features in C++/CLI that would simplify this
>> process?
>Well, you can certainly fold the 2 C++ DLLs (managed and unmanaged) into 1 :
>just have the "organized class, localized data, and generally imposed some
>structure" stuff be directly in the managed C++ DLL (MC++ and C++/CLI can
>call directly on Win32).
Thanks, Arnaud. Do you happen to know of any code samples that would
illustrate the new syntax?