您好,请问您在再现群主的代码时,出现过图一问题吗?
我把int _tmain(int argc, _TCHAR* argv[]) 改成
int main(int argc, _TCHAR* argv[]) 出现了同样的错误
我改成
int main()
去掉里面的参数后又出现图二错误:
如果您方便,请帮忙分享一下您的再现方法,非常感谢?
给点干货吧
Fortran代码
module mixcompile
use iso_c_binding
implicit none
contains
subroutine cpp_print(cpp_char, n) bind(c, name="f90print")
use iso_c_binding
implicit none
type(c_ptr), value:: cpp_char
integer(c_int), value:: n
character(len=n), pointer:: f_string
call c_f_pointer(cpp_char, f_string)
write(*, '("Length of string:", 1x, I4)')n
write(*, *)f_string
end subroutine
end module
c++代码
#include <string>
extern "C" {void f90print(const char*, int);};
int main(int argc, char *argv[])
{
std::string s{"0123456789"};
f90print(s.c_str(), s.size());
for(int i=0; i<argc; i++){
s = argv;
f90print(s.c_str(), s.size());
}
return 0;
}
编译命令
g++ a.f90 b.cc -lgfortran -o example pasuka 发表于 2016-11-18 08:47
给点干货吧
Fortran代码
module mixcompile
感谢您的回复,我想用到的是FORTRAN输出的DLL文件。 zhuhuanlai 发表于 2016-11-19 12:10
感谢您的回复,我想用到的是FORTRAN输出的DLL文件。
可惜了,看来ls对于程序编译还是一知半解。。sigh pasuka 发表于 2016-11-21 09:10
可惜了,看来ls对于程序编译还是一知半解。。sigh
哈哈,我属于非专业程序猿,算是半吊子,见笑了
页:
1
[2]