Skip to main content
Question

Pass SAFEARRAY to .net method

  • January 28, 2026
  • 1 reply
  • 15 views

Ken Schwartz
Forum|alt.badge.img+1

I am attempting to pass binary data from AcuCOBOL to a .NET method using a COMSAFEARRAY.  For example, the buffer parameter in the below .NET method:

public int addRow(byte[] buffer);

I am receiving a COM error when I call this method passing the COMSAFEARRAY.   If I use other data types like “string”, I do not have the error. Does anyone have any suggestions of how to pass data from acuCOBOL as a .NET byte array?

1 reply

Randy Zack
Forum|alt.badge.img
  • Rocketeer
  • January 29, 2026

Hi Ken,

It would be helpful to know a few things. (Even as a developer, I am sometimes confused about how all this .NET stuff works...)

How are you constructing the SAFEARRAY in COBOL to pass to the .NET method?

What is the exact error message you are seeing?

I’m confident that it is possible to do what you want to do, but I am unsure about what exactly needs to happen.

Thanks,