Prev: unformatted files (again)
Next: Darvon online no prescription. Darvon online prescriptions with no membership. no prescription Darvon fedex delivery
From: M.S. Breitenfeld on 6 Aug 2010 12:32 I'm having problems compiling the code below using gfortran (4.2,4.3,4.4.4.5). It gives the error: Error: Type 'link_info' at (1) is a parameter to the BIND(C) procedure 'liter_cb' but is not C interoperable because derived type 'info_t' is not C interoperable when I remove the module and compile just the function it compiles fine. Can I not use a bind(C) function in a module? MODULE liter_cb_mod USE ISO_C_BINDING CONTAINS FUNCTION liter_cb(link_info) bind(C) USE ISO_C_BINDING IMPLICIT NONE INTEGER(c_int) liter_cb TYPE, bind(C) :: info_t INTEGER(c_int) :: type END TYPE info_t TYPE(info_t) :: link_info liter_cb = 0 END FUNCTION liter_cb END MODULE liter_cb_mod PROGRAM main END PROGRAM main
From: Richard Maine on 6 Aug 2010 13:00 M.S. Breitenfeld <msbrtnfld(a)gmail.com> wrote: > I'm having problems compiling the code below using gfortran > (4.2,4.3,4.4.4.5). It gives the error: > > Error: Type 'link_info' at (1) is a parameter to the BIND(C) procedure > 'liter_cb' but is not C interoperable because derived type 'info_t' is > not C interoperable That error message is pretty clearly bogus, as your info_t is about as C interoperable as a derived type can be. > when I remove the module and compile just the function it compiles fine. > Can I not use a bind(C) function in a module? Yes, you can. Note that the above error message doesn't say anything like that. What it does refer to isn't anything that would relate to being in a module or not. Even if it were the case (it isn't) that you can't do such a thing in a module, I'd say that it would constitute a compiler bug to generate such a wildly irrelevant error message. Sounds to me like a hint that something else is wrong. The code looks fine to me as is. Both the compilers I have handy on this machine (g95 and Nag) are happy with it. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: steve on 6 Aug 2010 13:32 On Aug 6, 10:00 am, nos...(a)see.signature (Richard Maine) wrote: > M.S. Breitenfeld <msbrtn...(a)gmail.com> wrote: > > I'm having problems compiling the code below using gfortran > > (4.2,4.3,4.4.4.5). It gives the error: > > > Error: Type 'link_info' at (1) is a parameter to the BIND(C) procedure > > 'liter_cb' but is not C interoperable because derived type 'info_t' is > > not C interoperable > > That error message is pretty clearly bogus, as your info_t is about as C > interoperable as a derived type can be. > > > when I remove the module and compile just the function it compiles fine.. > > Can I not use a bind(C) function in a module? > > Yes, you can. Note that the above error message doesn't say anything > like that. What it does refer to isn't anything that would relate to > being in a module or not. Even if it were the case (it isn't) that you > can't do such a thing in a module, I'd say that it would constitute a > compiler bug to generate such a wildly irrelevant error message. Sounds > to me like a hint that something else is wrong. > > The code looks fine to me as is. Both the compilers I have handy on this > machine (g95 and Nag) are happy with it. How does one USE the function from the module? -- steve
From: M.S. Breitenfeld on 6 Aug 2010 13:59 It's used as a callback function (it's called from C) but used in the main program by C_FUNLOC(liter_cb) I went ahead and submitted a gfortran bug report. On 08/06/2010 12:32 PM, steve wrote: > On Aug 6, 10:00 am, nos...(a)see.signature (Richard Maine) wrote: >> M.S. Breitenfeld<msbrtn...(a)gmail.com> wrote: >>> I'm having problems compiling the code below using gfortran >>> (4.2,4.3,4.4.4.5). It gives the error: >> >>> Error: Type 'link_info' at (1) is a parameter to the BIND(C) procedure >>> 'liter_cb' but is not C interoperable because derived type 'info_t' is >>> not C interoperable >> >> That error message is pretty clearly bogus, as your info_t is about as C >> interoperable as a derived type can be. >> >>> when I remove the module and compile just the function it compiles fine. >>> Can I not use a bind(C) function in a module? >> >> Yes, you can. Note that the above error message doesn't say anything >> like that. What it does refer to isn't anything that would relate to >> being in a module or not. Even if it were the case (it isn't) that you >> can't do such a thing in a module, I'd say that it would constitute a >> compiler bug to generate such a wildly irrelevant error message. Sounds >> to me like a hint that something else is wrong. >> >> The code looks fine to me as is. Both the compilers I have handy on this >> machine (g95 and Nag) are happy with it. > > How does one USE the function from the module? > > -- > steve
From: steve on 6 Aug 2010 19:29
On Aug 6, 10:59 am, "M.S. Breitenfeld" <msbrtn...(a)gmail.com> wrote: > It's used as a callback function (it's called from C) but used in the > main program by C_FUNLOC(liter_cb) > > I went ahead and submitted a gfortran bug report. > Remove mangle context due to top posting. That does not answer my question. AFAIU, the routine cannot be USEd in any other fortran procedure. -- steve |