Skip to main content

Problem:

105 memory allocation error when invoking internal method of COM class that is passed a pointer

Resolution:

Be carefull when hand-coding (when not using the method wizard) any methods in a COM class. The reason is invoking the method using the INVOKE SELF syntax from within the COM class itself, the runtime will invoke it as a COM method (as opposed to a non-COM Ojbect COBOL method) and will coerce parameters to COM types.

This could especially be a problem passing a pointer as a parameter and the COM runtime coerces it to something else. In this case it is possible to end up getting a 105 (memory allocation) error. It is recommended to use the method wizard when adding COM methods to a class. The wizard will guide in creating parameters with proper types. If there is a need to hand-code any methods that accept non-COM types, then to create a separate Object COBOL class (one that does not inherit from olebase) and to add the methods there. Then, to instantiate it from the COM method code and to invoke those methods using any parameter types.

Old KB# 4357