Mailing list archive (omnetpp-l at omnetpp.org)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: [omnetpp] build JSimpleModule
Hi,
Today I returned to this problem, i solved it replacing the "? : ;"
conditional for a "if then else". The patch follows as attachment.
Other problem that I found was, when I build the JSimpleModule with the
default Makefile (created with opp_makemake), which contains the -O2
flag. When I run the simulation it simply stops with a segmentation
fault when Java code tries to access OMNeT++ core.
If I build it whit a lower -O flag or without it, the simulation runs
normally.
Anyone can explain this?
Thanks
Best regards,
Nuno
On 03/27/2008 03:26 PM, Nuno Alexandre Carvalho wrote:
> Hi,
>
> When I try to build the JSimpleModule v3.3-1, the JUtil.cc file
> generates the following error:
>> JUtil.cc: In member function ‘void JObjectAccess::setBooleanJavaField(const char*, jboolean)’:
>> JUtil.cc:153: error: ‘JUtil::jenv->JNIEnv_::SetBooleanField(((JObjectAccess*)this)->JObjectAccess::javaPeer, fieldID, ((int)value))’ has type ‘void’ and is not a throw-expression
>> ...
> You can see with more detail in the attachment.
>
> This files are from the JSimpleModule tarball, available at
> http://www.omnetpp.org/filemgmt/singlefile.php?lid=126
> I'm using Ubuntu linux, OMNeT++ 3.3, Java SUN 1.6.0_03-b05 and g++ 4.1.3.
>
> Thanks
>
> Best regards,
> Nuno
>
diff -ru jsimplemodule-3.3-1.orig/JUtil.cc jsimplemodule-3.3-1/JUtil.cc
--- jsimplemodule-3.3-1.orig/JUtil.cc 2007-01-08 13:23:58.000000000 +0000
+++ jsimplemodule-3.3-1/JUtil.cc 2008-04-08 11:42:00.000000000 +0100
@@ -146,7 +146,10 @@
{ \
jmethodID methodID; jfieldID fieldID; \
getMethodOrField(fieldName, "set", "(" CODE ")V", CODE, methodID, fieldID); \
- methodID ? jenv->Call##Type##Method(javaPeer, methodID, value) : jenv->Set##Type##Field(javaPeer, fieldID, value); \
+ if (methodID) \
+ jenv->Call##Type##Method(javaPeer, methodID, value); \
+ else \
+ jenv->Set##Type##Field(javaPeer, fieldID, value); \
checkExceptions(); \
}
@@ -174,7 +177,10 @@
jmethodID methodID; jfieldID fieldID;
getMethodOrField(fieldName, "set", "(" JSTRING ")V", JSTRING, methodID, fieldID);
jstring str = jenv->NewStringUTF(value);
- methodID ? jenv->CallObjectMethod(javaPeer, methodID, str) : jenv->SetObjectField(javaPeer, fieldID, str);
+ if (methodID)
+ jenv->CallObjectMethod(javaPeer, methodID, str);
+ else
+ jenv->SetObjectField(javaPeer, fieldID, str);
checkExceptions();
}
_______________________________________________
OMNeT++ Mailing List
options: http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
archive: http://www.omnetpp.org/listarchive/index.php
Home |
Main Index |
Thread Index