Highlighted
Absent Member.
Absent Member.
1610 views

[archive] Calling a .Net dll

[Migrated content. Thread originally posted on 02 January 2009]

Calling a .Net dll I get the following error when executing the CREATE command: "CoCreateInstance failed for AcuToNet.IAcuToNet
COBOL error at 0003CE in ...acu".

Does this imply an error on my part or is it rather a Acucobol problem?

Here's my create statement and the definition file for my, very small, class:
CREATE "@gmail"
NAMESPACE IS "gmail"
CLASS-NAME IS "gMail"
HANDLE IN GMAIL-OBJECT.

*** definition file ***
* ACUCOBOL-GT Version 8.0.0 .NET Copy Book - Generated On 2009-01-02 18:02:19

OBJECT @ASSEMBLY
NAME "@gmail"
VERSION "1.0.0.0"
CULTURE "neutral"
STRONG "7d4102c6b24711d0"


* FULLY-QUALIFIED-NAME gmail.gMail, gmail, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7d4102c6b24711d0

* gmail.gMail
NAMESPACE "gmail"
CLASS "gMail"
MODULE "gmail.dll"

CONSTRUCTOR, 0, @CONSTRUCTOR1

* [Class: gMail] System.String SendMailFromFile(System.String)
METHOD, 0, "@SendMailFromFile"
"BSTR" @filename, TYPE 8
RETURNING "BSTR", TYPE 8

******

Any help appreciated.

Regards,
Hans Jivesten
0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a .Net dll

Once I had done some more research on the forum I found the solution.
1, regasm acutonet.dll
2, marshal.exe /regserver
3, move my custom dll to where wrun32.exe is, not where my .acu files are. Should be OK also to have the dll in GAC, but I have not tried that yet.

Best regards,
Hans Jivesten
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a .Net dll

Hi Hans,

I saw your solution but, for me, is not the better solution.
The same for register assembies in GAC.
Doing so, you make your application dependent on the machine (the pc) and the s.o., so you can't do simply "XCOPY deploy" of your software.
We use an alternative solution: strongly sign of assermblies, and relative store of keys in the "All Trust" profile .NET framework registry.
Once you done this, all your future .NET assemblies signed with thid key will be publicly available in your system: problem solved for ever. 🙂

Fabio
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a .Net dll

I was pulling my hair out with this the other day, and I found I had to use the following command:

regasm acutonet.dll /codebase

Quoting Microsoft at http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx

The /codebase option "Creates a Codebase entry in the registry. The Codebase entry specifies the file path for an assembly that is not installed in the global assembly cache. You should not specify this option if you will subsequently install the assembly that you are registering into the global assembly cache. The assemblyFile argument that you specify with the /codebase option must be a strong-named assembly."

Since we were not putting this DLL into the GAC, we needed to use the /codebase option. Once we did this, we no longer received the "CoCreateInstance failed ..." error.

Paul
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a .Net dll

Thanks for sharing this experience.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.