<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Fortran Commons/Virtual Memory in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967261#M23201</link>
    <description>See the DLLEXP1 and DLLEXP2 examples - it's easy and similar to using shareable images on VMS.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
    <pubDate>Wed, 12 Dec 2001 04:13:04 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2001-12-12T04:13:04Z</dc:date>
    <item>
      <title>Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967253#M23193</link>
      <description>Hello, &lt;BR /&gt; &lt;BR /&gt;I'm porting code from Alpha to Win2K.  The fortran code I have uses a fortran common mapped to a map section to share data between processes.  I'm trying now to port that code to a PC.  I want to map the fortran common to virtual memory (thru MapViewOfFileEx, i.e.). &lt;BR /&gt; &lt;BR /&gt;On Alpha, I use the COLLECT statement in the link options file to equate the common name with the map section name, but there does not seem to be the equivalent on the PC.  The documentation says that fortran commons are relocatable, but there is no reference on how to do that. &lt;BR /&gt; &lt;BR /&gt;Any help would be greatly appreciated.  Thanks. &lt;BR /&gt; &lt;BR /&gt;Dave Yasko</description>
      <pubDate>Tue, 18 Sep 2001 22:18:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967253#M23193</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-09-18T22:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967254#M23194</link>
      <description>We have used 'shared memory' through MAPVIEWOFFILE etc. to replicate what used to be called the GLOBAL SECTION on VAX/UNIX(?). I can post  / send you some example code if it will help...?</description>
      <pubDate>Tue, 18 Sep 2001 22:29:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967254#M23194</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-09-18T22:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967255#M23195</link>
      <description>Dan, &lt;BR /&gt; &lt;BR /&gt;Thanks.  That would be great.  The code that I'm porting uses a large (sometimes greater than 512K, 512K is the maximum on VAX) fortran common.  I thought I had several solutions to mapping a common to shared memory, but none of them worked.  Example code would be great.  Please post here.  Thanks again. &lt;BR /&gt; &lt;BR /&gt;Dave</description>
      <pubDate>Wed, 19 Sep 2001 01:36:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967255#M23195</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-09-19T01:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967256#M23196</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;*------------------------------------------------------------------------------  &lt;BR /&gt;*  &lt;BR /&gt;*	MM	   MM DDDDDDD	CCCCCC  &lt;BR /&gt;*	MMM	  MMM DD	DD CC	 CC		Copyright  2001 MDC Technology Limited  &lt;BR /&gt;*	MMMM MMMM DD	DD CC			Library	:	USER  &lt;BR /&gt;*	MM MMM MM DD	DD CC			File	:	SHARED_FILE.FOR  &lt;BR /&gt;*	MM	M  MM DD	DD CC	 CC		Author	:	D. J. Crosby  &lt;BR /&gt;*	MM	   MM DDDDDDD	CCCCCC  &lt;BR /&gt;*  &lt;BR /&gt;*  &lt;BR /&gt;*	Description  &lt;BR /&gt;*	-----------  &lt;BR /&gt;*		Create a file and expand it to the size of the item, stream item_key,  &lt;BR /&gt;*		or stream_key arrays, or a preset size, whichever is the smaller.  &lt;BR /&gt;*  &lt;BR /&gt;*	Arguments  &lt;BR /&gt;*	---------  &lt;BR /&gt;*		share_name			name of shared memory  &lt;BR /&gt;*		kind				the 'kind' of share to create  &lt;BR /&gt;*		handle				shared file handle  &lt;BR /&gt;*		number_of_records	file size  &lt;BR /&gt;*  &lt;BR /&gt;*	Returns  &lt;BR /&gt;*	-------  &lt;BR /&gt;*		TRUE if shared file created OK, otherwise FALSE  &lt;BR /&gt;*  &lt;BR /&gt;*	Revision History  &lt;BR /&gt;*	----------------  &lt;BR /&gt;*  &lt;BR /&gt;*	Version		Date		By		HD No.		Reason  &lt;BR /&gt;*		1		12-Jan-99	DR		----		Produce working trans_gs  &lt;BR /&gt;*  &lt;BR /&gt;*------------------------------------------------------------------------------  &lt;BR /&gt;  &lt;BR /&gt;	LOGICAL*4 FUNCTION shared_file (share_name, kind, handle, number_of_records)  &lt;BR /&gt;  &lt;BR /&gt;*------------------------------------------------------------------------------  &lt;BR /&gt;  &lt;BR /&gt;	IMPLICIT NONE  &lt;BR /&gt;  &lt;BR /&gt;*	--------  &lt;BR /&gt;*	Includes  &lt;BR /&gt;*	--------  &lt;BR /&gt;  &lt;BR /&gt;	INCLUDE	'MODEL_PRIV.CMN'  &lt;BR /&gt;	INCLUDE	'MODEL_ERROR.PRM'  &lt;BR /&gt;	INCLUDE	'RTOSHR.CMN'  &lt;BR /&gt;	INCLUDE	'FILE_IO.CMN'  &lt;BR /&gt;	INCLUDE	'WIN32RTO.INC'  &lt;BR /&gt;  &lt;BR /&gt;*	---------  &lt;BR /&gt;*	Arguments  &lt;BR /&gt;*	---------  &lt;BR /&gt;  &lt;BR /&gt;	CHARACTER*9		share_name			! name of shared memory  &lt;BR /&gt;	CHARACTER*4		kind				! A string, containing:  &lt;BR /&gt;										! 'item': map item to memory  &lt;BR /&gt;										! 'strm': map stream to memory  &lt;BR /&gt;										! 'itky': map item_key to memory  &lt;BR /&gt;										! 'stky': map stream_key to memory  &lt;BR /&gt;	INTEGER*4		handle				! shared file handle  &lt;BR /&gt;	INTEGER*4		number_of_records	! file size (#items/strms)  &lt;BR /&gt;  &lt;BR /&gt;*	---------  &lt;BR /&gt;*	Variables  &lt;BR /&gt;*	---------  &lt;BR /&gt;  &lt;BR /&gt;	INTEGER*4		my_error				! error code from Win32 API  &lt;BR /&gt;	CHARACTER*255	the_file				! filename to open/create  &lt;BR /&gt;	INTEGER*4		path_len				! length of RTO+ path  &lt;BR /&gt;	INTEGER*4		lpBuffer				! address of an RTO+ array  &lt;BR /&gt;	INTEGER*4		nNumberOfBytesToWrite	! self-explanatory  &lt;BR /&gt;	INTEGER*4		lpOverlapped			! not used  &lt;BR /&gt;	INTEGER*4		result_1				! whether file-write worked okay  &lt;BR /&gt;	INTEGER*4		lpNumberOfBytesWritten  ! self-explanatory  &lt;BR /&gt;	INTEGER*4		dwSize					! size of file in bytes  &lt;BR /&gt;	LOGICAL*4		created_here			! .TRUE. if new file created  &lt;BR /&gt;  &lt;BR /&gt;*	---------  &lt;BR /&gt;*	Functions  &lt;BR /&gt;*	---------  &lt;BR /&gt;  &lt;BR /&gt;	LOGICAL*4		rto_file_mapping  &lt;BR /&gt;  &lt;BR /&gt;*------------------------------------------------------------------------------  &lt;BR /&gt;*	-------------------  &lt;BR /&gt;*	Assume it will work  &lt;BR /&gt;*	-------------------  &lt;BR /&gt;  &lt;BR /&gt;	shared_file = .TRUE.  &lt;BR /&gt;	created_here = .FALSE.  &lt;BR /&gt;  &lt;BR /&gt;*	----------------------------------  &lt;BR /&gt;*	Obtain the path to create the file  &lt;BR /&gt;*	----------------------------------  &lt;BR /&gt;  &lt;BR /&gt;*	Avoid the trailing null-terminator  &lt;BR /&gt;	path_len = LEN_TRIM (DiagnosticPath(1:254))  &lt;BR /&gt;	the_file(1:path_len) = DiagnosticPath(1:path_len)  &lt;BR /&gt;  &lt;BR /&gt;*	-------------------------------  &lt;BR /&gt;*	Add the name for the RTO+ array  &lt;BR /&gt;*	-------------------------------  &lt;BR /&gt;  &lt;BR /&gt;*	first the file name  &lt;BR /&gt;	the_&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Sep 2001 17:15:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967256#M23196</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-09-19T17:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967257#M23197</link>
      <description>OK - so it didn't like me posting that much!  &lt;BR /&gt;Dave , if you can be specific about what you need, I can post some relevant snippets. Otherwise e-mail me at crosbyd!!!@!!!mdctech.com (without the !s)  &lt;BR /&gt;  &lt;BR /&gt;Dan</description>
      <pubDate>Wed, 19 Sep 2001 17:19:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967257#M23197</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-09-19T17:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967258#M23198</link>
      <description>Although I can't help with your problem I am also looking for the same solution. Have you had any success ? &lt;BR /&gt; &lt;BR /&gt;Thanks - Mark</description>
      <pubDate>Tue, 11 Dec 2001 22:17:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967258#M23198</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-12-11T22:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967259#M23199</link>
      <description>Mark, &lt;BR /&gt; &lt;BR /&gt;Our method works for our problem, whether it solved Dave's I don't know. I can forward you the files I sent to Dave if you mail me at crosbyd_spamguard_@mdctech.com. (remove the _spamguard_) - they may help! &lt;BR /&gt; &lt;BR /&gt;Dan</description>
      <pubDate>Tue, 11 Dec 2001 22:29:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967259#M23199</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-12-11T22:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967260#M23200</link>
      <description>Mark, &lt;BR /&gt; &lt;BR /&gt;The code that Dan Crosby sent gave me a lot to think about.  It was very useful.  Without it, I don't think I would have figured out how to access the Win32 functions. &lt;BR /&gt; &lt;BR /&gt;I don't know exacly what you need, but I found that I need the functionality of the COLLECT link options file statement.  Without it, I need to modify neerly all of my Fortran code.  On the PC, running CVF, there appears to be no equivalent statement.  I was lucky though, that project got put on the back burner for now, so I don't have to worry about it yet. &lt;BR /&gt; &lt;BR /&gt;I found, to port my Fortran code from Alpha to Win32, I had thee options: &lt;BR /&gt; &lt;BR /&gt;   1) I could save myself needing to modify every line of code that uses variables in my (shared) global common by providing a pointer to each variable and populating them after mapping to shared memory. It looks like: &lt;BR /&gt; &lt;BR /&gt;      (in header file) &lt;BR /&gt;      COMMON / GLOBAL / STARTCOM, &lt;VARIABLE name=""&gt;, &lt;VARIABLE name...=""&gt;... &lt;BR /&gt;      INTEGER*4 STARTCOM &lt;BR /&gt;      INTEGER*4 &lt;VARIABLE name=""&gt; &lt;BR /&gt;      ... &lt;BR /&gt;      INTEGER*4 PARAMETER :: &lt;VARIABLE name=""&gt;OS__ = &lt;VARIABLE byte="" offset="" in="" common=""&gt; &lt;BR /&gt;      POINTER (&lt;VARIABLE name=""&gt;P__, &lt;VARIABLE name=""&gt;) &lt;BR /&gt;      ... &lt;BR /&gt;      (in intitialization code) &lt;BR /&gt;      STARTCOMP__ = MAPVIEWOFFILE(...) &lt;BR /&gt;      &lt;VARIABLE name=""&gt;P__ = STARTCOMP__ + &lt;VARIABLE name=""&gt;OS__ &lt;BR /&gt; &lt;BR /&gt;      This works for us because the include file is automatically generated by a utility that can be modified (See comment after option #3). &lt;BR /&gt; &lt;BR /&gt;   2) I could change my global common to a structure, assign a pointer to it, and set that pointer's value from pointer returned from MapViewOfFile(...).  This is the easiest to impliment and understand, but it does require you to prepend the name of the instance of that record (i.e. SIMCOM%) to each global common variable name in your code. &lt;BR /&gt; &lt;BR /&gt;   3) I could convert all of my code to C or C++.  The Fortran code is pretty simple, but there is a bunch of it, so this was the last option. &lt;BR /&gt; &lt;BR /&gt;My choice was #2 above, because the include file that defines our global common is generated by a utility that was written about 15 years ago.  It has been modified a few times, but doing so is an exercise frought with peril.  Modifications for option #2 to that program are probably much easier than for option #1. &lt;BR /&gt; &lt;BR /&gt;I know I get a bit wordy, but I hope this helps you. &lt;BR /&gt; &lt;BR /&gt;Happy Holidays!!! &lt;BR /&gt;Dave Yasko&lt;/VARIABLE&gt;&lt;/VARIABLE&gt;&lt;/VARIABLE&gt;&lt;/VARIABLE&gt;&lt;/VARIABLE&gt;&lt;/VARIABLE&gt;&lt;/VARIABLE&gt;&lt;/VARIABLE&gt;&lt;/VARIABLE&gt;</description>
      <pubDate>Wed, 12 Dec 2001 01:24:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967260#M23200</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-12-12T01:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran Commons/Virtual Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967261#M23201</link>
      <description>See the DLLEXP1 and DLLEXP2 examples - it's easy and similar to using shareable images on VMS.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Wed, 12 Dec 2001 04:13:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Fortran-Commons-Virtual-Memory/m-p/967261#M23201</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2001-12-12T04:13:04Z</dc:date>
    </item>
  </channel>
</rss>

