bugGNU Octave - Bugs: bug #62019, [octave forge] (windows)...

 
 

bug #62019: [octave forge] (windows) actxserver is unable to create a server instance with a custom COM object

Submitter:  None
Submitted:  Thu 10 Feb 2022 01:06:01 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  lostbard
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 6.4.0
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 22 Feb 2022 08:54:02 PM UTC, comment #5: 

Yes - assuming fixed by change in repo - It will appear in the next release of the package

John Donoghue <lostbard>
Group Member
Tue 22 Feb 2022 07:01:53 PM UTC, comment #4: 

Okay to close?  Trying to close bugs which have been fixed ahead of 7.1 release.

Rik <rik5>
Group administrator
Thu 17 Feb 2022 02:21:47 PM UTC, comment #3: 
John Donoghue <lostbard>
Group Member
Tue 15 Feb 2022 01:56:51 PM UTC, comment #2: 

Missing an '&' in the unknown->QueryInterface(IID_IDispatch, (void **)&disp) line

John Donoghue <lostbard>
Group Member
Tue 15 Feb 2022 01:55:39 PM UTC, comment #1: 

Octave is using:


CoCreateInstance (clsID, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER,
IID_IDispatch, (void**)&disp)


So is probally the same issue as you guessed as python.


Untested ... but maybe will work by changing _COM_.cc per the diff below:


diff -r fc0ddf4d5b22 src/__COM__.cc
--- a/src/__COM__.cc    Tue Feb 15 07:45:37 2022 -0500
+++ b/src/__COM__.cc    Tue Feb 15 08:53:39 2022 -0500
@@ -514,6 +514,7 @@
           std::wstring progID = string_to_wstring (args (0).string_value ());
           CLSID clsID;
           IDispatch *disp;
+         IUnknown *unknown;

           if (CLSIDFromProgID (progID.c_str (), &clsID) != S_OK)
             {
@@ -521,12 +522,19 @@
               return retval;
             }
           if (CoCreateInstance (clsID, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER,
-                                IID_IDispatch, (void**)&disp) != S_OK)
+                                IID_IUnknown, (void**)&unknown) != S_OK)
             {
               error ("actxserver: unable to create server instance for `%s'",
                       args (0).string_value ().c_str ());
               return retval;
             }
+         if (unknown->QueryInterface(IID_IDispatch, (void **)disp) != S_OK)
+            {
+              unknown->Release ();
+              error ("actxserver: unable to get dispatch interface for `%s'",
+                      args (0).string_value ().c_str ());
+              return retval;
+            }

           retval = octave_value (new octave_com_object (disp, false));
         }


John Donoghue <lostbard>
Group Member
Thu 10 Feb 2022 01:06:01 PM UTC, original submission:  

I have made a custom COM object in C# with .NET Core 6. The project containing the COM object was successfully built and afterwards I registered the generated '*.comhost.dll' file with 'regsvr32'.

The registration was successful and the object works fine with Excel VBA as well as Matlab.

Here is the code I entered in Octave and the error response I got:


octave:1> pkg load windows
octave:2> actxserver('HelloWorldCOMObject')
error: actxserver: unable to create server instance for `HelloWorldCOMObject'
octave:3>


I have also had a problem with trying to use the COM object in Python but there was a workaround for the error that occurred in Python.

I am suspecting that the code that is executed behind actxserver() has a similar problem as Python.

The Python solution and the reason for the error are described in this link: https://stackoverflow.com/questions/71047993/net-core-6-0-com-interoperability-issues-with-python-octave

I will also add the .csproj file and the .cs file I used to create the *.comhost.dll for the COM object as attached files.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #52839:  COMNetCore6.csproj added by None (396B - application/xml)
file #52840:  ComObject.cs added by None (310B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by lostbard (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-22 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-02-17 lostbard StatusNone Ready For Test
        Assigned toNone lostbard
    2022-02-10 None Attached File- Added COMNetCore6.csproj, #52839
        Attached File- Added ComObject.cs, #52840

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code