From: Chris on 22 Apr 2010 10:14 On Apr 22, 7:39 am, "Maxim S. Shatskih" <ma...(a)storagecraft.com.no.spam> wrote: > > But this will render the code "unsafe" > > Why? It won't, I don't know what Pavel is talking about. The C++ .NET shim will know about both the C# object and the C struct with the variable length or whatever problem is being faced here. The C++ code does the dirty work, the C# gets handed a "clean" object that has all the marshaled data.
From: Pavel A. on 23 Apr 2010 09:59 Because of presence of native code. To achieve exact arch specific data layout, you must be native code. Otherwise it would be possible in pure .net languages without any marchaling headache. (OTOH, I've seen c# samples on codeproject that simply parse a binary struct byte by byte, without using .net methods ) Regards, --pa "Maxim S. Shatskih" <maxim(a)storagecraft.com.no.spam> wrote in message news:Ox$Aajh4KHA.620(a)TK2MSFTNGP02.phx.gbl... >> But this will render the code "unsafe" > > Why? > > -- > Maxim S. Shatskih > Windows DDK MVP > maxim(a)storagecraft.com > http://www.storagecraft.com >
From: Maxim S. Shatskih on 23 Apr 2010 15:52 > Because of presence of native code. So, all native code is unsafe? :-) Windows kernel, shell, and so on? > (OTOH, I've seen c# samples on codeproject that simply parse a binary struct > byte by byte, without using .net methods ) Well, the matter of taste. I would create a native wrapper DLL instead. -- Maxim S. Shatskih Windows DDK MVP maxim(a)storagecraft.com http://www.storagecraft.com
From: Pavel A. on 23 Apr 2010 16:29 "Maxim S. Shatskih" <maxim(a)storagecraft.com.no.spam> wrote in message news:#68aN6x4KHA.6132(a)TK2MSFTNGP05.phx.gbl... >> Because of presence of native code. > > So, all native code is unsafe? :-) Windows kernel, shell, and so on? Sure... we get a handful of evidence, every patch tuesday. >> (OTOH, I've seen c# samples on codeproject that simply parse a binary >> struct >> byte by byte, without using .net methods ) > > Well, the matter of taste. I would create a native wrapper DLL instead. Me too. But managers tend to see "purity" of managed code as value. If such a wrapper DLL will be the only native piece in the project, chances are it won't be approved. Regards, -- pa > -- > Maxim S. Shatskih > Windows DDK MVP > maxim(a)storagecraft.com > http://www.storagecraft.com >
First
|
Prev
|
Pages: 1 2 3 4 Prev: Replacing USBSTOR.sys Next: Can DIFx be used to install NDIS protocol driver? |