Passing two dimensional arrays by reference when calling COM DLL from C# -


i have registered com dll , have reference in c# project in visual studio 2012.

i want call 1 function dll. has following signature in documentation:

hresult crating(     [in] bstr compmodelname,     [in] long refrigcode,     [in] long powsupcode,     [in] variant_bool tempmidpoint,     [in] variant_bool suctionsgr,     [in] double suctionretgastemp,     [in] double subcooling,     [in, out] safearray(variant_bool)* requiredoutput,     [in, out] safearray(double)* capacity,     [in, out] safearray(double)* power,     [in, out] safearray(double)* current,     [in, out] safearray(double)* massflow,     [in, out] safearray(double)* heatreject,     [in, out] safearray(long)* errorcode); 

but when open object browser see following:

void crating(     string compmodelname,      int refrigcode,      int powsupcode,      bool tempmidpoint,      bool suctionsgr,      double suctionretgastemp,      double subcooling,      ref system.array requiredoutput,      ref system.array capacity,      ref system.array power,      ref system.array current,      ref system.array massflow,      ref system.array heatreject,      ref system.array errorcode); 

requiredoutput, capacity, power, current, massflow, heatreject, errorcode 2 dimensional arrays.

can please tell how call function c#?

p.s.: tried call function , got safearraytypemismatchexception:

string compmodelname = "zr40k3e-tfd"; int refrigcode = 4; int powsupcode = 1; bool tempmidpoint = false; bool suctionsgr = false; double suctionretgastemp = 10; double subcooling = 1;  array requiredoutput = new bool[] { true, true, true, true, true, true };  array capacity = array.createinstance(typeof(array), 2); capacity.setvalue(new double[2] { 0 , 6.4 }, 0); capacity.setvalue(new double[2] { 50, 0   }, 1);  array power = array.createinstance(typeof(array), 2); power.setvalue(new double[2] { 0, 0 }, 0); power.setvalue(new double[2] { 0, 0 }, 1);  array current = array.createinstance(typeof(array), 2); current.setvalue(new double[2] { 0, 0 }, 0); current.setvalue(new double[2] { 0, 0 }, 1);  array massflow = array.createinstance(typeof(array), 2); massflow.setvalue(new double[2] { 0, 0 }, 0); massflow.setvalue(new double[2] { 0, 0 }, 1);  array heatreject = array.createinstance(typeof(array), 2); heatreject.setvalue(new double[2] { 0, 0 }, 0); heatreject.setvalue(new double[2] { 0, 0 }, 1);  array errorcode = array.createinstance(typeof(array), 2); errorcode.setvalue(new int[2] { 0, 0 }, 0); errorcode.setvalue(new int[2] { 0, 0 }, 1);  kcrate crksrv = new kcrate(); // without ref crksrv.crating(compmodelname, refrigcode, powsupcode, tempmidpoint, suctionsgr, suctionretgastemp, subcooling, requiredoutput, capacity, power, current, massflow, heatreject, errorcode); // ref - same error crksrv.crating(compmodelname, refrigcode, powsupcode, tempmidpoint, suctionsgr, suctionretgastemp, subcooling, ref requiredoutput, ref capacity, ref power, ref current, ref massflow, ref heatreject, ref errorcode); 


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -