Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

A specified class is not registered in the registration database

Yuva_C_
Beginner
2,009 Views

I am having the error "A specified class is not registered in the registration database" returned by function "COMCreateObjectByGUID" aioll the time when I try to call .net function from fortran function.

Business case: I have to call .net function from Fortran on Windows platforms

Solution approach:

1. Create the DLL from .net source code as COM component and register this DLL using regasm. Exact command being used is "%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319/RegAsm.exe DotNetDAL.dll /tlb: dotnetdal.tlb". This is registering the DLL and creating the file dotnetdal.tlb

2. Launch Intel Visual Fortran Module Wizard to load this dotnetdal.tlb file to create equivalent fortran source file "dotnetdal.f90" as COM interface.

3. Create Intel Visual Fortran project solution in visual studio and write fortran function in source file "DotNetDAL_FortranFunc.f90" which uses COM function to call fortran function in "dotnetdal.f90".

4. Compilation was successful and when I execute the executable, it always giving me the error message "A specified class is not registered in the registration database" (the return macro is "REGDB_E_CLASSNOTREG") after executing the function "COMCreateObjectByGUID". I have tried with all possible "CLSCTX_*" as 2nd argument to "COMCreateObjectByGUID" but this function is always failing with return value "REGDB_E_CLASSNOTREG"

I am attaching the complete solution for your reference. kindly assist to overcome this issue. Thanks in advance.

0 Kudos
5 Replies
Yuva_C_
Beginner
2,009 Views

Please find the solution attached here. It seems the attachment is not uploaded correctly in first post.

0 Kudos
Yuva_C_
Beginner
2,009 Views

Need your kind assistance to understand this issue and resolve it ASAP. Please let me know if you need any other details or you want me to perform some specific steps to understand my problem better?

0 Kudos
Steven_L_Intel1
Employee
2,009 Views

There isn't a lot of expertise here with using .NET. I did note that if I tried to use the 32-bit regasm it said your DLL wasn't a valid .NET assembly. When I use the Framework64 version, as you did, it registers. Then when I try to run the program I don't get the error you do, but instead get 0x80070002, which is "Cannot instantiate COM object with different namespace from ProgId value". I was also seeing "EEFileLoadException" errors logged and I found this StackOverflow question about the error. Maybe this will give you some hints.

Since you didn't provide the full project for creating the DLL (I think at least the .hie file is needed, maybe some others), there's nothing more I can do here.

0 Kudos
Yuva_C_
Beginner
2,009 Views

Hi Steve,

Thanks for looking into the issue. I have figured out the issue. The root cause is how .net DLL is built. It was built with "Platform target" set as "X64" on visual studio. When I change this platform target as either "Any CPU" or "X86" to build the .net DLL and use 32-bit regasm to register the DLL, the issue is resolved. I am able to call .net method from fortran and successfully pass the values and get the returned values to Fortran. We can consider this issue as resolved.

Thanks again for your time on it.

0 Kudos
Steven_L_Intel1
Employee
2,009 Views

Glad to hear it!

0 Kudos
Reply