- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is wrong with the following?
module mod_dill use, intrinsic :: iso_c_binding, only: c_char implicit none; private public :: ipaddr type, bind(c, name='dill_ipaddr') :: ipaddr character(c_char) :: address(32) end type ipaddr end module mod_dill ! ------ Build started: Project: test_tcp, Configuration: Debug|x64 ------ ! ! Compiling with Intel(R) Visual Fortran Compiler 19.0.5.281 [Intel(R) 64]... ! mod_dill.f90 ! mod_dill.f90(8): error #5082: Syntax error, found ',' when expecting one of: ) ! mod_dill.f90(8): error #5082: Syntax error, found '::' when expecting one of: , <END-OF-STATEMENT> ; ! mod_dill.f90(8): error #6274: This statement must not appear in the specification part of a module. ! mod_dill.f90(9): error #6236: A specification statement cannot appear in the executable section. ! mod_dill.f90(10): error #6274: This statement must not appear in the specification part of a module. ! mod_dill.f90(8): error #6404: This name does not have a type, and must have an explicit type.! mod_dill.f90(8): error #6632: Keyword arguments are invalid without an explicit interface. [NAME] ! mod_dill.f90(8): error #6404: This name does not have a type, and must have an explicit type. [BIND] ! mod_dill.f90(8): error #6404: This name does not have a type, and must have an explicit type. [IPADDR]
Merry Christmas
N
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Norman K.,
Merry Christmas.
As explained by Andrew, NAME= clause is not an option in a derived-type definition such as with your 'ipaddr' type.
Did you mean to have NAME= clause in a type declaration of a de facto 'global' object as shown below?
module mod_dill use, intrinsic :: iso_c_binding, only: c_char implicit none; private public :: ipaddr type, bind(C) :: ipaddr character(c_char) :: address(32) end type ipaddr type(ipaddr), bind(C, name='dill_ipaddr'), public, save :: dill_ipaddr !<-- NAME= ok here end module mod_dill
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove ", name='dill_ipaddr'" there is no syntax in TYPE to make an alias name in standard Fortran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Norman K.,
Merry Christmas.
As explained by Andrew, NAME= clause is not an option in a derived-type definition such as with your 'ipaddr' type.
Did you mean to have NAME= clause in a type declaration of a de facto 'global' object as shown below?
module mod_dill use, intrinsic :: iso_c_binding, only: c_char implicit none; private public :: ipaddr type, bind(C) :: ipaddr character(c_char) :: address(32) end type ipaddr type(ipaddr), bind(C, name='dill_ipaddr'), public, save :: dill_ipaddr !<-- NAME= ok here end module mod_dill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so...
"Bind with name" an instance, but not a whole class
Makes sense,
Thanks both
Merry Christmas
N
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