From: robin on 28 Nov 2009 14:45 "James Tursa" <aclassyguywithaknotac(a)hotmail.com> wrote in message news:699og5101lodpq8o1huhemti0poipj3ji3(a)4ax.com... | The non-standard %LOC() and %VAL() constructs are available in the | Intel Fortran and Compaq Fortran compilers that I have (32-bit, | WinXP). Are these constructs available in other compilers such as | gfortran, f95, etc? Not necessarily. That's what "non-standard" means.
From: robin on 28 Nov 2009 14:45 "James Tursa" <aclassyguywithaknotac(a)hotmail.com> wrote in message news:jbmog5tsbate8l8qfjcs7l4p1t1ivb444o(a)4ax.com... | On Tue, 24 Nov 2009 21:52:06 +0100, Reinhold Bader <Bader(a)lrz.de> | wrote: | | >> mwPointer, intent(in) :: mx | > | >the above line (among others) does not seem to be a Fortran statement - do you | >run this through a preprocessor before compiling? | | Yes. mwPointer and mwSize are token replaced by a pre-processor with | integer*4 or integer*8 as appropriate for the installation. Choosing one or the other can be done automatically without a preprocessor, using standard Fortran. Much of your code is non-standard.
From: James Tursa on 29 Nov 2009 07:56 On Sat, 28 Nov 2009 19:45:13 GMT, "robin" <robin_v(a)bigpond.com> wrote: >"James Tursa" <aclassyguywithaknotac(a)hotmail.com> wrote in message news:jbmog5tsbate8l8qfjcs7l4p1t1ivb444o(a)4ax.com... >| On Tue, 24 Nov 2009 21:52:06 +0100, Reinhold Bader <Bader(a)lrz.de> >| wrote: >| >| >> mwPointer, intent(in) :: mx >| > >| >the above line (among others) does not seem to be a Fortran statement - do you >| >run this through a preprocessor before compiling? >| >| Yes. mwPointer and mwSize are token replaced by a pre-processor with >| integer*4 or integer*8 as appropriate for the installation. > >Choosing one or the other can be done automatically without a preprocessor, >using standard Fortran. > The pre-processor stuff was not my choice ... that is how The Mathworks has designed the interface for connecting Fortran with MATLAB. As a programmer, if you want to make sure you are using the correct types when calling MATLAB Fortran routines, then you use the supplied macros for mwPointer, mwSize, etc. >Much of your code is non-standard. > I have acknowledged that. The pre-processor stuff is necessary per the previous paragraph. The LOC and VAL stuff is necessary as an alternative to C_LOC and C_F_POINTER for compilers that do not have C interop capability. For these compilers, I would gladly code using only standard constructs, but I have no idea how to get a Fortran pointer constructed from seperate C pointer and size info other than what I have previously shown (calling an implicit routine using %VAL and then returning the Fortran pointer via a COMMON block). In fact, I was rather pleased that I was able to do it at all for those compilers. That being said, I will probably develop another package of similar code using C_LOC and C_F_POINTER for later compilers per suggestions from this group. James Tursa
From: James Tursa on 29 Nov 2009 08:04
On Sat, 28 Nov 2009 19:45:08 GMT, "robin" <robin_v(a)bigpond.com> wrote: >"James Tursa" <aclassyguywithaknotac(a)hotmail.com> wrote in message news:699og5101lodpq8o1huhemti0poipj3ji3(a)4ax.com... >| The non-standard %LOC() and %VAL() constructs are available in the >| Intel Fortran and Compaq Fortran compilers that I have (32-bit, >| WinXP). Are these constructs available in other compilers such as >| gfortran, f95, etc? > >Not necessarily. That's what "non-standard" means. > Thanks. I already knew the "not necessarily" and "non-standard" per my original post. Since I didn't have these other compilers installed I was hoping someone with those compilers could answer the question quickly. I got what I needed from Tobias. James Tursa |