VC Not Playing Well With Others

I'm trying to call a DLL that I wrote in C# from a GNT called from a native COBOL program.  The call is failing with "Server defined OLE exception" (800401F3): Invalid class string...."  Now, from past experience, this usually means that the DLL is not registered.  However, I did register the DLL.


Now, here's the weird part.  If I remove the GNT from the equation, the call to the DLL works fine.  So I can call the DLL from a native cobol program, but not from a GNT written in native cobol called by the native cobol driver.


I've attached the source code that I'm working with.  Program1.cbl is the driver.  Compress.cs is the code for the DLL.  Ziphandd.cbl is the GNT making the call.  None of the programs are very complicated.


Any suggestions would be most welcome.


Mike

SAMPLE.ZIP
  • Verified Answer

    Your copybooks are missing from the zip but the first thing I immediately noticed is that you are defining the COM class name incorrectly in the .gnt program.

    In program1.cbl:

      COMPRESSOR IS CLASS "$OLE$IOICompression.Compress".

    In ZIPHANDD.CBL:

      COMPRESSOR IS CLASS "$OLE$IOICompress.Compress".

    According to the name in the C# class the name in program1.cbl is correct so that is why it works from there.

    Thanks.

  • Chris - Thanks for helping out.  I must've looked at that 50 times, and I had someone else look at it and neither of us caught that.  Sometimes the answer is tricky to find, sometimes it's right under ones nose.