fortran interface for 'void func (void * foo)' ?

fortran interface for 'void func (void * foo)' ?

uhbarney's picture

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?

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
james@elementyl.com's picture

That would be something like

SUBROUTINE FUNC (FOO)
INTEGER(POINTER_LEN) FOO

and calling like

CALL FUNC (LOC(blob))

James

Steve Lionel (Intel)'s picture

In James' example, replace

POINTER_LEN

with

INT_PTR_KIND()

Steve

Steve
james@elementyl.com's picture

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

Login to leave a comment.