Problems with Interop in C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Olbert

    Problems with Interop in C#

    Subject: Problems with Interop in C#

    We are having problems using Interop with a Vb6 ActiveX Dll in C# code in
    Net2 using Vs2005. Below are the signatures of the method that is the
    problem. It is the last argument (e.g., "out obj" in C#) that is returned
    corrupted. It should be an array of integers. In one simple test App this
    argument does return an array of integers reliably. In the actual App it
    returns one or two integer arrays but then it starts returning corrupted
    data. The difference between the two App's is on of complexity and that the
    actual App uses many more threads then the test App.

    We use Tlbimp.exe in the PreBuild step. We do not have the Vb6 code or Pdb
    file.

    ANY suggestions would be GREATLY appreciated.

    C# signature--
    bool b=pdc.Get_Array Data(out Transfer_Comple te,out DataNum,out
    SamplingPeriod, out obj);

    IDL signature--
    [id(0x00000012), helpstring("met hod Get_ArrayData")]
    VARIANT_BOOL Get_ArrayData(
    [out] long* Transfer_Comple te,
    [out] long* DataNum,
    [out] double* SamplingPeriod,
    [out] VARIANT* arrayData);

    IL signature--
    .method public hidebysig newslot virtual
    instance bool Get_ArrayData([out] int32& Transfer_Comple te,
    [out] int32& DataNum,
    [out] float64& SamplingPeriod,
    [out] object& marshal( struct)
    arrayData) runtime managed internalcall
    {
    .custom instance void
    [mscorlib]System.Runtime. InteropServices .DispIdAttribut e::.ctor(int32) = ( 01
    00 12 00 00 00 00 00 )
    .override DKITPKIDriverRc w.IPKIDriver::G et_ArrayData
    } // end of method PKIDriverClass: :Get_ArrayData
    --
    John Olbert

    --
    John Olbert

Working...