ah well, whim of the languages

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: smith (rcsTAKEOUT_at_smithvoiceTAKEOUT.com)
Date: 03/21/04


Date: Sun, 21 Mar 2004 08:38:22 GMT

Eh, the heck with it, I coded the 20k dll with the two functions in C# and
am calling into it from VB.net. It just seems strange to me that by just
doing the exact same thing in C# the call to AddAttribute and
ModifyAttribute both work without a hiccup. Same exact values & types in
all variables in the Locals Windows of both languages... exact same.

And we do nothing at all with the parameters from the VB.net call to the
dll, just pass in the same values as we were with the VB.net code. So again
the Locals Windows look exactly the same.

I just don't get the difference:

C#:

uint AddAttribute(
  [In] ushort wStreamNum,
  [In,MarshalAs(UnmanagedType.LPWStr)] string pszName,
  [Out] out ushort pwIndex,
 [In] WMT_ATTR_DATATYPE Type,
 [In] ushort wLangIndex,
[In, MarshalAs(UnmanagedType.LPArray)] byte[] pValue,
[In] uint dwLength );

VB.net port attempts:

Function AddAttribute(ByVal wStreamNum As UInt16, _
  ByVal pszName As String, _
  ByRef pwIndex As UInt16, _
  ByVal Type As WMT_ATTR_DATATYPE, _
  ByVal wLangIndex As UInt16, _
  ByVal pValue As Byte(), _
  ByVal dwLength As UInt32) As UInt32

or

Function AddAttribute(ByVal wStreamNum As UInt16, _
 <MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As String, _
 ByRef pwIndex As UInt16, _
 ByVal Type As WMT_ATTR_DATATYPE, _
 ByVal wLangIndex As UInt16, _
 <MarshalAs(UnmanagedType.LPArray)> ByVal pValue As Byte(), _
 ByVal dwLength As UInt32) As UInt32

thanks anyway.

-s



Relevant Pages

  • Problems using serial port under Wince 5.0
    ... I know the hardware is OK, since the bootloader uses the serial port ... UINT16 read; ... UINT32 speed; ... void rx_wait; ...
    (microsoft.public.windowsce.embedded)
  • Re: Problems using serial port under Wince 5.0
    ... I know the hardware is OK, since the bootloader uses the serial port ... UINT16 read(char *buff, UINT16 max_len); ... UINT32 speed; ...
    (microsoft.public.windowsce.embedded)
  • Re: DSK5510
    ... void DSK5510_mset (uint32 m_addr, uint16 m_value) ... At a guess you're running into compiler optimisation issues when trying to write repeated values to a register, in which case you probably need to do something like this: ...
    (comp.dsp)
  • Re: Marshalling for C struct with arrays
    ... Public Declare Function xlReceive Lib "vxlapi.dll" (ByVal PortHandle ... As UInt32, ByRef pEventCount As UInt16, ByVal pMessages As ...
    (microsoft.public.dotnet.languages.vb)