使用包装C ++和Fortran for Java编译dll [英] Compile dll with wrapper c++ and fortran for Java

查看:66
本文介绍了使用包装C ++和Fortran for Java编译dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我有一个大问题.我想从Fortran dll中调用Java中的例程.我有可让我与fortran连接的包装器c ++,但是当我尝试使用c ++中的包装器和fortran代码编译dll时,例如,我得到了一些链接错误,但它没有 找到符号netcal.我应该一起编译这两个代码吗?我必须如何编译?我使用compaq visual.我向您展示了我拥有的简单代码.

I have a big problem. I want to call a routine in Java from Fortran dll. I have the wrapper c++ that let me conect with fortran, but when I try to compile the dll with the wrapper in c++ and the fortran code I obtain some link errors, for example, it does't find the symbol netcal. Should I compile the two codes together?? How I must compile it? I use compaq visual. I show you the simply code that I have.

c ++中的文件为:

#include< jni.h>

#include <jni.h>

#include"clase.h"

#include "clase.h"

外部"C"无效&netbsp; netcal(long * a,long * b,long * c);

extern "C" void  netcal(long*a, long*b, long*c);

JNIEXPORT无效JNICALL Java_clase_netcal

JNIEXPORT void JNICALL Java_clase_netcal

(JNIEnv *,jobject,jint a,jint b,jint c)

(JNIEnv *, jobject, jint a, jint b, jint c)

{   

{    

     netcal(& a,& b,& c);

     netcal(&a, &b, &c);

};

 

,fortran中的代码为:

子例程netcal(a,b,c)

subroutine netcal(a,b,c)

整数,目标,意图(in):: a,b

integer, target, intent(in)::a,b

整数,目标,意图(out):: c

integer, target, intent(out)::c

c = a + b

c=a+b

返回    

return     

end子例程netcal

end subroutine netcal


推荐答案

你好,

我们是由于不熟悉Java和Fortran,该论坛仅适用于VC ++.这是跨平台问题,在这里不合时宜.

We are not familiar with Java and Fortran, this forum is for VC++ only. This is cross platform issue which is off-topic here.

谢谢供您理解.

干杯,

Yi 

这篇关于使用包装C ++和Fortran for Java编译dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆