------- Comment #3 from fxcoudert at gcc dot gnu dot org  2006-04-25 06:04 
-------
(In reply to comment #2)
> This was fixed for the non windows case for sure.

Yes:

$ cat ftesti.f90 
subroutine print_from_gfortran(txt)
  implicit none
  character :: txt
  print *,txt
end subroutine print_from_gfortran
$ ./bin/gfortran -shared -o ftesti.so ftesti.f90 
$ cat ctesti.c #include <stdio.h>
#include <dlfcn.h>

void print_from_gcc(char* txt) {
  printf("%s\n",txt);
}

int main(int argc, char** argv) {
  void * hdl = dlopen("./ftesti.so", RTLD_LAZY);
  void (*print_from_gfortran)(char *) = dlsym(hdl, "print_from_gfortran_");

  print_from_gcc     ("c");
  (*print_from_gfortran)("f");
  print_from_gcc     ("c");
  (*print_from_gfortran)("f");
  dlclose (hdl);

  return 0;
}
$ gcc -o ctesti.exe ctesti.c -ldl
$ ./ctesti.exe 
c
 f
c
 f

And this even works when libgfortran is only available as a static library (as
is the case on mingw32). I'll try to look deeper into this, but it looks very
strange...


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27046

Reply via email to