- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
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!
Link Copied
13 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - jdchambless@gmail.com
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!
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
COM still works fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
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.
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The attachment is not visible. You need to do the last step in the instructions (see link below).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - I'll take a look but it may not be for a few days.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page