Home »
Public Forums »
archive »
Re: IDL code with fortran subroutine and C linker on OSX
Re: IDL code with fortran subroutine and C linker on OSX [message #44548] |
Tue, 28 June 2005 16:15 |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
laurel wrote:
> I have an IDL code, and a fortran subroutine called mainsub. I have a C
> linker as a go-between from IDL and fortran called field_c. They both
> compile fine on their own, but don't seem to want to be linked. Here is
> my set of compiling commands so far:
>
> f90 -c mainsub.f
> gcc -c field_c.c
> (these both work fine)
> gcc -bundle -flat_namespace -fno-leading-underscore -o field_c.so
> field_c.o mainsub.o KT_2003_sub.o
> (KT is another fortran subroutine called in mainsub)
I am a little confused as to what you are trying to do. Are you
building a DLM? Or do you just have some c and fortran code that you
are trying to build which you'll call via SPAWN?
If you're building a DLM I can't answer your question but I can offer a
few nuggets.
An IDL dlm makefile entry for OSX has these flags:
gcc -O2 -I$(IDL_DIR)/external -no-cpp-precomp -dynamic \
-fPIC -fno-common -D_REENTRANT myDLM.c
gcc -flat_namespace -undefined suppress -bundle -o myDLM.so myDLM.o
I don't run OSX so I can't say if this works but there you go...
Or better yet, can you use MAKE_DLL? Check out the docs and
build_testmodule.pro in $IDL_DIR/external/dlm
Have you looked at Stein Vidar Hagfors Haugan's "dlmform"? I just did a
search and while his server was down the page was cached on google. It
is a perl script that will build the c wrapper for your fortran code
automagically. Don't know if that will help.
If you're *not* making a DLM then, well. I can't help :(
-Rick
|
|
|
Current Time: Wed Oct 08 15:22:00 PDT 2025
Total time taken to generate the page: 0.00644 seconds