- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am sorry that I can't reply to the original post.
The interface of 'writestring' is as follows:
subroutine writestring(filename,msg) bind(c,name='writestring')
use iso_c_binding
implicit none
type(c_ptr),value::filename,msg
end subroutine
After I replaced 'C_LOC' by 'LOC', the following error displayed:
So I think it can't be replaced.
error #6633: The type of the actual argument differs from the type of the dummy argument. [LOC]
Thanks,
Tang Laoya
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The type returned by LOC is integer of size of 4 or 8 depending on 32 or 64 bit build
Whereas the type returned by C_LOC is C_PTR.
You have to be consistent with regards to argument type (in INTERFACE and CALL (and receiver function)) even though the bit patters may be the same.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the interface, replace "type(c_ptr), value" with "character, dimension(*)". In the call, simply remove the C_LOC or LOC.
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