Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
17 Views

Providing a SafeArray to a COM object

Dear All,

I am trying to pass an array of floats using a COM object written in C#.

After registering the COM DLL, the code is created by the FORTRAN COM Wizard in Daniel-COM.f90

In Daniel-main.f90, I create a class which uses the array_test function from the COM object.

The interface to array_test requires safe arrays.

Q1. Which function from the COM object should I use ($$AnalysisDb_ArrayTest or $IAnalysisDb_ArrayTest)? What is the difference?

Q2. I use two procedures MakeVariantSafeArray and GetVariantSafeArray, Is this the correct way to create a safe array for to pass to the COM object? (Needless to say that the call to $$AnalysisDb_ArrayTest fails to return zero (0=success); the program compiles and builds fine).

Any ideas on the above?

Thank you for your efforts.

Daniel.

0 Kudos
2 Replies
Highlighted
17 Views

I haven't looked at your code, but you should not be calling the generated routines with names that start with $. There are safearray manipulating routines in module OLEAUT32 - SafeArrayGetDim, SafeArrayGetElement, etc. You might want to look at the sample program VB.NET-Safearrays to see how they are used.

0 Kudos
Highlighted
Beginner
17 Views

Thank you Steve. I'll review the example.

The $ routines are the ones needed to access the COM object. They are generated by the FORTRAN wizard.

 

0 Kudos