- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have been using the COM Server Wizard to wrap some legacy code and create a component that will be called from IIS/ASP.
One key to success seems to be getting rid of "global data" and turning it into "object data" in the class derived-type definition. Thus anything in Fortran COMMON, variables in SAVE statements etc., are moved to the derived-type definition.
My question is about local variables defined within the Fortran subroutines. It seems to me that local vars might only work if they are given the AUTOMATIC attribute (i.e. allocated on the stack). Variables with STATIC attribute surely amount to global data and may fight if two instances of the component are running on different threads. Have I got this right? The project generated by the COM Server wizard does not appear to enforce AUTOMATIC allocation in project settings.
Or maybe my understanding of apartment threading is incomplete?
One key to success seems to be getting rid of "global data" and turning it into "object data" in the class derived-type definition. Thus anything in Fortran COMMON, variables in SAVE statements etc., are moved to the derived-type definition.
My question is about local variables defined within the Fortran subroutines. It seems to me that local vars might only work if they are given the AUTOMATIC attribute (i.e. allocated on the stack). Variables with STATIC attribute surely amount to global data and may fight if two instances of the component are running on different threads. Have I got this right? The project generated by the COM Server wizard does not appear to enforce AUTOMATIC allocation in project settings.
Or maybe my understanding of apartment threading is incomplete?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Peter,
It seems to me that local vars might only work if they are given the AUTOMATIC attribute (i.e. allocated on the stack). Variables with STATIC attribute surely amount to global data and may fight if two instances of the component are running on different threads. Have I got this right?
Yes, that is correct.
The project generated by the COM Server wizard does not appear to enforce AUTOMATIC allocation in project settings.
I'll add this to my list of future work.
Regards,
Leo
It seems to me that local vars might only work if they are given the AUTOMATIC attribute (i.e. allocated on the stack). Variables with STATIC attribute surely amount to global data and may fight if two instances of the component are running on different threads. Have I got this right?
Yes, that is correct.
The project generated by the COM Server wizard does not appear to enforce AUTOMATIC allocation in project settings.
I'll add this to my list of future work.
Regards,
Leo

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