COM class cannot be found when running .net code from Matlab

0

I'm using c# do build a few libraries which we then use from within Matlab 64bit. The c# library is compiled to 64bit so that we can use it from Matlab. The c# library uses an interop to call a COM component which is legacy 32bit code. When running the tests in c# everything works but if I use the library from Matlab I get the following error:

Message: Unable to cast COM object of type '...' to interface type '...'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{...}' failed due to the following error: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). Source: mscorlib

To me it looks like the runtime is looking for the 64bit of the COM class but I don't understand why but afaik visual studio 2017 is still 32 bit thats why it is picking the right COM. Any help is welcome.

UPDATE

I tried to run the code using a 64bit test loaded and I get the same error, so it was running from VS because it is 32bit. Having identified that, is there a way to force a 64bit execution context to call 32bit COM components?

Thanks

c#
.net
matlab
com
asked on Stack Overflow Nov 20, 2018 by MeTitus • edited Nov 20, 2018 by MeTitus

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0