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

Providing a SafeArray to a COM object

Ilie__Daniel
Beginner
286 Views

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
Steven_L_Intel1
Employee
287 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
Ilie__Daniel
Beginner
287 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
Reply