This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/55465] Name collision in C binding (calling C from Fortran)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55465

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu.org

--- Comment #3 from janus at gcc dot gnu.org 2012-11-26 16:37:31 UTC ---
(In reply to comment #0)
> Essentially I am trying to use the binding to call from Fortran the same C
> function in two different ways. The interface sql_set_env_attr has two
> implementations, one sql_set_env_attr_int where the parameter value is passed
> as c_int and another one sql_set_env_attr_ptr where the parameter value is
> passed as c_ptr.

I'm not sure if this is legal. In any case, here is a reduced test case:


module m_odbc_if

  implicit none

  interface sql_set_env_attr
    function sql_set_env_attr_int( input_handle,attribute,value,length ) &
                                   result(res) bind(C,name="SQLSetEnvAttr")
      use, intrinsic :: iso_c_binding
      implicit none
      type(c_ptr), value :: input_handle
      integer(c_int), value :: attribute
      integer(c_int), value :: value
      integer(c_int), value :: length      
      integer(c_short) :: res
    end function
    function sql_set_env_attr_ptr( input_handle,attribute,value,length ) &
                                   result(res) bind(C,name="SQLSetEnvAttr")
      use, intrinsic :: iso_c_binding
      implicit none
      type(c_ptr), value :: input_handle
      integer(c_int), value :: attribute
      type(c_ptr), value :: value
      integer(c_int), value :: length      
      integer(c_short) :: res
    end function
  end interface

end module


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]