- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm porting a large mixed language product to run under NT. Some source files are in Fortran, some in C. I've managed to generate Fortran prototypes for most of the C functions, but I don't know how to deal with 'void*' arguments as in:
void func (void * foo);
Of course, the intent is to be able to provide the function with any type of argument by reference without compiler complaint.
My latest thoughts are to somehow use a Fortran pointer when calling such a C function, but I'm not sure which pointer type to use, or how to best arrange things. Any advice out there?
void func (void * foo);
Of course, the intent is to be able to provide the function with any type of argument by reference without compiler complaint.
My latest thoughts are to somehow use a Fortran pointer when calling such a C function, but I'm not sure which pointer type to use, or how to best arrange things. Any advice out there?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That would be something like
SUBROUTINE FUNC (FOO)
INTEGER(POINTER_LEN) FOO
and calling like
CALL FUNC (LOC(blob))
James
SUBROUTINE FUNC (FOO)
INTEGER(POINTER_LEN) FOO
and calling like
CALL FUNC (LOC(blob))
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In James' example, replace
POINTER_LEN
with
INT_PTR_KIND()
Steve
POINTER_LEN
with
INT_PTR_KIND()
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or do a
USE DFWINTY
to define POINTER_LEN. I personally like the look of
INTEGER(POINTER_LEN)
a little better than
INTEGER(INT_PTR_KIND())
James
USE DFWINTY
to define POINTER_LEN. I personally like the look of
INTEGER(POINTER_LEN)
a little better than
INTEGER(INT_PTR_KIND())
James
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