calling factorycast applets from C++


Thread Starter


Using C++/CNI in a Linux environment, I can successfully call the factorycast java classes to retrieve data, as long as I do it in a single thread. If there is more than one thread, I get a segmentation fault when the Java garbage collector kicks in. The backtrace is below:

#0 0x00000000 in ?? ()
#1 0x080c7c69 in com.schneiderautomation.factorycast.Ref.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) () at
#2 0x080c7b47 in com.schneiderautomation.factorycast.Ref.setAddress(java.lang.String) () at
#3 0x08058ae9 in clsFactoryCast::getIntRegisters (this=0x8197880,
startRegister=40799, count=1, aryvalues=0xbf5ff664)
at clsFactoryCast.hxx:88
#4 0x080586b0 in clsModiconEthernet::getData (this=0x8115000)
at clsModiconEthernet.hxx:125
#5 0x08057e92 in clsScan::doPoll (this=0x8115000) at clsScan.hxx:230
#6 0x08057b24 in startThread (arg=0xbffffaac) at scanner.cxx:43
#7 0x409d5e51 in pthread_start_thread () from /lib/
#8 0x409d5ecf in pthread_start_thread_event () from /lib/
#9 0x40b0e6ea in clone () from /lib/

Michael Griffin

I am no expert on this, but is Factorycast designed to be thread safe? Is the error just from having multiple threads of any type, or only from multiple threads with FatoryCast classes in them? If the latter, I would suspect
Factorycast must be used single threaded. Take the above speculation with a grain of salt, as I've never used it.