I have a need for .NET code to call AcuCobol programs. AcuCobol provides a COM
interface with a number of methods. To the extent that I have tested this
interface everything works.
The problem is that this interface has a limitation (50) on the number of
distinct parameters that can be passed from .NET to an individual AcuCobol
program. I need to exceed that limit by at least a factor of three. (This is
legacy code and as much as I would wish to change it, I cannot.)
This is the definition of the specific COM method as displayed by OleView:
[id(0x60020009), helpstring("Calls a COBOL program.")]
HRESULT Call(
[in] VARIANT* Name,
[in, out, optional] VARIANT* arg0,
[in, out, optional] VARIANT* arg1,
[in, out, optional] VARIANT* arg2,
[in, out, optional] VARIANT* arg3,
[in, out, optional] VARIANT* arg4,
[in, out, optional] VARIANT* arg5,
[in, out, optional] VARIANT* arg6,
[in, out, optional] VARIANT* arg7,
[in, out, optional] VARIANT* arg8,
[in, out, optional] VARIANT* arg9,
[in, out, optional] VARIANT* arg10,
[in, out, optional] VARIANT* arg11,
[in, out, optional] VARIANT* arg12,
[in, out, optional] VARIANT* arg13);
Since each of the variables is a variant and a variant can hold an array, my
thought was to package all of the parameters up into an array in the .NET code
and pass the array into an intermediate AcuCobol adapter program that would
"unpack" the parameters from the array and pass them on to the legacy AcuCobol
code.
I have put together a test cast that does all of this but when I call the COM
object to fire up the AcuCobol adapter program, I get back an error message
from the AcuCobol runtime that says that what I passed has too few elements.
My guess is that the marshalling logic sees the VARIANT* and only marshalls a
single value.
I am reading Adam Nathan's book on .NET and COM, but there are 1500+ pages and
my quick scan does not show anything that is on point. Can anyone point me to
the path that leads to a solution?
Jon Stonecash
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com