简体   繁体   中英

Returning byte array from C# DLL to C++ application

I am returning a byte array byte[] result from a function in C# DLL as:

void WriteSingleCoils(ushort id, byte unit, ushort startAddress, bool OnOff, ref byte[] result)

I am calling this function from the C++ code. All other parameters have no problem but how to pass the last parameter result which is actually a returning argument from the C++ code?

You can do the following -

void WriteSingleCoils(ushort id, byte unit, ushort startAddress, bool OnOff, array<Byte> ^result)

It is tested. Works fine for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM