"FrancoisViljoen" <francoisv at dev dot barloworldoptimus dot com> wrote in
message news:C8069DF4-07A3-4215-9343-(E-Mail Removed)...
> [DllImport("filename.dll", EntryPointentrypointname")]
> private static extern int DoStuff(ref Series pData, ref StdStat
> pStdstat, ref Settings pSettings, ref EXSM pExSm, ref BOXJ pBj, ref SMA
> pSma,
> ref Dscr pDsc, ref Croston pCroston);
>
> where each of the parameters is a struct of which some contain arrays.
When you define those structs in C#, you probably need to be using the
"fixed" keyword, otherwise C# assumes they are SAFEARRAYs.
>
>
>
>
> "DeveloperX" wrote:
>
>> Can you post the function prototype? I'd guess there's some sort of
>> pointer to a buffer and a length parameter as a minimum?
>>
>>
>> FrancoisViljoen wrote:
>> > Hi there,
>> >
>> > I need to make a call into an unmanaged DLL from a C# application, and
>> > I am
>> > getting a SafeArrayTypeMismatchException which basically means that
>> > either
>> > what I am sending to the DLL is incorrect, or what I am getting out is
>> > not
>> > what the C# code expects.
>> >
>> > My question is this: How do I know which array is the troublesome one?
>> > Within the call there are numerous arrays all contained within
>> > different
>> > structs.
>> >
>> > Regards,
>> >
>> > FV
>>
>>
|