[Migrated content. Thread originally posted on 08 June 2009]
Hello,I've tried everything to figure this issue out, and have only run into dead ends.
We have two machines in the office (XP and Vista) which do not receive the error. On all the other machines (1 Vista, 4 XP) we receive the error.
Here is the error we receive:
Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
We receive the error when a function in a .Net DLL exits.
I have created a simple .Net DLL and a Cobol program that shows the error.
Here is the .Net C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Diagnostics;
namespace TestCall
{
public class Class1
{
public void display_msg(string msg_to_display)
{
MessageBox.Show("Message = " msg_to_display);
}
}
}
Here is the .def file that is created by NetDefGen:
* ACUCOBOL-GT Version 8.0.0 .NET Copy Book - Generated On 6/8/2009 10:12:01 AM
OBJECT @ASSEMBLY
NAME "@TestCall"
VERSION "1.0.0.0"
CULTURE "neutral"
STRONG "null"
* FULLY-QUALIFIED-NAME TestCall.Class1, TestCall, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
* TestCall.Class1
NAMESPACE "TestCall"
CLASS "Class1"
MODULE "TestCall.dll"
CONSTRUCTOR, 0, @CONSTRUCTOR1
* [Class: Class1] Void display_msg(System.String)
METHOD, 0, "@display_msg"
"BSTR" @msg_to_display, TYPE 8
And here is the COBOL program I use to call the .Net DLL:
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTCALL.
AUTHOR. EDC (PWD).
SECURITY.
REMARKS.
Calls a .Net DLL.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
COPY 'testcall.def'.
.
*
INPUT-OUTPUT SECTION.
FILE-CONTROL.
*
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
*
01 TESTCALL-HANDLE USAGE IS HANDLE.
*
*
PROCEDURE DIVISION.
*
DECLARATIVES.
END DECLARATIVES.
*
ACU-MAIN-LOGIC.
CREATE "TestCall"
NAMESPACE IS "TestCall"
CLASS-NAME IS "Class1"
HANDLE IS TESTCALL-HANDLE.
MODIFY TESTCALL-HANDLE "display_msg" ("This is it!").
EXIT PROGRAM.
STOP RUN.
When the COBOL program runs, it calls the DLL with no problem and the DLL displays the message box. After pressing OK on the message box, the following error is displayed:
Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
I am compiling the cobol program with:
SET CBLFLAGS= -o @.acu -e @.erf
CCBL32 -zd testcall.cblWe are using version 8.0.1.2363 of the compiler.
The runtime version is 8.0.1.2427
The .Net DLL is compiled for x86. I've attached the .Net C# Project if you wanted to see what other settings we are using.
Thank you for any help you can provide.
Paul DuBois
EDC Technology



