2

I'm very new to Fortran. Currently I'm writing (or trying to write) a fortran application which calls a C-library.

I've got a few things working so far but I'm stuck with the init-function from the library which expects argc and argv just to get the program name which is calling the function.

The C-library expects pointers to argc and argv:

void init(gint argc, gchar ***argv);

I have no idea how to express that ***argv in fortran. The other functions only need integers so I had no trouble using this skeleton for them:

interface
    subroutine init( argc, argv)
        ??
    end subroutine ee_init
end interface

call init( , )
1
  • Is gchar *** something like a two dimensional array of pointers? Commented Nov 1, 2011 at 8:53

2 Answers 2

5

You will probably need to write your own wrapper function in C, init_fortran, or similar which you call from Fortran and takes arguments in a way you can express in Fortran, then converts them to what the C init function expects.

Sign up to request clarification or add additional context in comments.

Comments

4

I would suggest using module ISO_C_BINDING and pass a pointer to an array of pointers, if i understand it correctly.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.