Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将C代码与Fortran module.function()链接_C_Fortran_Dynamic Linking - Fatal编程技术网

将C代码与Fortran module.function()链接

将C代码与Fortran module.function()链接,c,fortran,dynamic-linking,C,Fortran,Dynamic Linking,我必须在Solaris下构建一个C共享库(.so),以便将其用作来自Exelis IDL语言的DLM(动态可加载模块) 此C库必须使用Fortran模块中包含的一些Fortran f90函数 我可以编译C和Fortran代码(使用-fpic,-G,…),但从C调用Fortran库有问题 在my.so文件中,模块中包含的Fortran函数被命名为 模块功能 例如: $nm idl_spi.so [290]|…| FUNC | GLOB | 0 | 15 spi|m|libscient.spi|u

我必须在Solaris下构建一个C共享库(.so),以便将其用作来自Exelis IDL语言的DLM(动态可加载模块)

此C库必须使用Fortran模块中包含的一些Fortran f90函数

我可以编译C和Fortran代码(使用-fpic,-G,…),但从C调用Fortran库有问题

在my.so文件中,模块中包含的Fortran函数被命名为 模块功能

例如: $nm idl_spi.so [290]|…| FUNC | GLOB | 0 | 15 spi|m|libscient.spi|u scient|u init|u common_

在我的C代码中,我不能使用以下任何一项:

spi_科学_初始_公共_()

=>在库中找不到符号(未完成名称)

spi_m_libscient.spi_scient_init_common()

=>未知结构spi_m_libscient

有没有一种方法可以从C中调用Fortran模块\ u name.函数\ u name()

或在编译module.function()时更改Fortran行为, 例如,重命名objet文件中的模块函数


我可以找到任何f90命令行选项

您可以更改Fortran代码,例如使用吗?是的,通过
bind(C,name=“your_name”)
设置绑定名称是一种方法。非常感谢。我刚刚在我的函数声明后添加了绑定(C),现在它可以工作了我看到iso_C_绑定出现在Fortran 2003中,而我使用的是F95有什么强烈的理由你必须在2016年严格保持F95吗?