Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Объявления
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Обсуждение

Assumed shape arrays in the hierarchy (.hie) file of a COM DLL

jdchambless
Начинающий
1 943Просмотр.
Hello all,

I have written a COM DLL using in Intel Fortran, and everything has been pretty easy so far, thanks to all the good discussions on this forum. I've run into a problem with one of my arrays, though. I would like the array argument for one of the methods to be an assumed shape type so that I can pass arrays of different sizes (though always two dimensional). Seems pretty simple, since "Assumed-Shape" is one of the options under the array's properties. However, if I don't set the dimensions of the array correctly (in my case, it is [191,8]), I get an error saying:

Subscript #2 of the array F$AssumedArrayName has value 1 which is greater than the upper bound of -1.

It could be that I have my terminology mixed up, and I am using "asssumed-shape" incorrectly; any help on this issue would be appreciated.
Thanks!
0 баллов
13 Ответы
g_f_thomas
Начинающий
1 943Просмотр.
Hello all,

I have written a COM DLL using in Intel Fortran, and everything has been pretty easy so far, thanks to all the good discussions on this forum. I've run into a problem with one of my arrays, though. I would like the array argument for one of the methods to be an assumed shape type so that I can pass arrays of different sizes (though always two dimensional). Seems pretty simple, since "Assumed-Shape" is one of the options under the array's properties. However, if I don't set the dimensions of the array correctly (in my case, it is [191,8]), I get an error saying:

Subscript #2 of the array F$AssumedArrayName has value 1 which is greater than the upper bound of -1.

It could be that I have my terminology mixed up, and I am using "asssumed-shape" incorrectly; any help on this issue would be appreciated.
Thanks!

Arrays in COM are SafeArrays, no assumed or deferred arrays allowed. Why use COM? Even MS has abandoned it.

Gerry
Steven_L_Intel1
Сотрудник
1 943Просмотр.
The generated jacket code should handle the conversion to and from SafeArrays. I have not run into this issue myself - can you attach a ZIP of a sample project?

COM still works fine.
g_f_thomas
Начинающий
1 943Просмотр.
COM still works fine.

Really, so do DOS and QuickWin in a fashion and they've all been in the doldrums for a decade or more. When did the module wizard or com server things last move forward? Basically not since CVF days. They've nowhere to go.

Gerry
Steven_L_Intel1
Сотрудник
1 943Просмотр.
The module wizard now handles .NET assemblies. The COM Server Wizard was rewritten and handles more datatypes. Short of going to full managed code (just ask Lahey how well that worked for them), the combination of these two handles pretty much anything you might want to do from Fortran to interact with tools and applications such as Office and even VS itself.
jdchambless
Начинающий
1 943Просмотр.
The generated jacket code should handle the conversion to and from SafeArrays. I have not run into this issue myself - can you attach a ZIP of a sample project?

COM still works fine.

Hi Steve,
Actually, it seems that the only hangup is during execution of a debug build. The release build runs fine. The line that the debug version gets hung up on is:

call FOR_DESCRIPTOR_ASSIGN(f$AssumedShapeArray, ptr$AssumedShapeArray, &
SIZEOF(f$AssumedShapeArray(lb$AssumedShapeArray(1), lb$AssumedShapeArray(2))), &
IOR(FOR_DESCRIPTOR_ARRAY_DEFINED, IOR(FOR_DESCRIPTOR_ARRAY_NODEALLOC, &
FOR_DESCRIPTOR_ARRAY_CONTIGUOUS)), 2, da$AssumedShapeArray)

Oddly enough, it is only occurring when I implement it into a team project that previously had all the variables declared explicitly. If I create a new local project and make the arrays Assumed-Shape at the outset, both debug and release versions run fine.

Any reason why that would be?
Steven_L_Intel1
Сотрудник
1 943Просмотр.
Does the problem happen only when a compiler version earlier than 11 is selected? I know there was a bug in FOR$DESCRIPTOR_ASSIGN in that it did not set up the bounds correctly. That is fixed in version 11.
jdchambless
Начинающий
1 943Просмотр.
Does the problem happen only when a compiler version earlier than 11 is selected? I know there was a bug in FOR$DESCRIPTOR_ASSIGN in that it did not set up the bounds correctly. That is fixed in version 11.

I only have version 11. Can you change which compiler version you are using somehow?

jdchambless
Начинающий
1 943Просмотр.
Quoting - jdchambless

I only have version 11. Can you change which compiler version you are using somehow?


I had the switch "/check:bounds" added to my "Additional Options" in the Configuration PropertiesFortranCommand Line page. When I removed this option, everything worked fine. I assuming that it should still work when this option is set, but I'm not sure.
Steven_L_Intel1
Сотрудник
1 943Просмотр.
Well, if you turn off bounds checking, then you get no bounds checking! I'd be concerned that something isn't right here and would like to see a test case I can build and run.
jdchambless
Начинающий
1 943Просмотр.
Well, if you turn off bounds checking, then you get no bounds checking! I'd be concerned that something isn't right here and would like to see a test case I can build and run.

I've attached the files for the sample program. You will need to access the DLL from some kind of client (I use MS Excel and the "Test.xls" file), unless you have some other voodoo method.
Thanks.
Steven_L_Intel1
Сотрудник
1 943Просмотр.
The attachment is not visible. You need to do the last step in the instructions (see link below).
jdchambless
Начинающий
1 943Просмотр.
The attachment is not visible. You need to do the last step in the instructions (see link below).

I added them to the previous post. Sorry about that.
Steven_L_Intel1
Сотрудник
1 943Просмотр.
Thanks - I'll take a look but it may not be for a few days.
Ответить