UnsatisfiedLinkError:with gcc linked cyg.dll under J@v@-1.6

2011-05-07 Thread christian Montanari
many are not using gnu-java, the orginial sun-java, it is certainly more baroc !

anyway, I am trying to link a DLL with gcc then to load it with
Java(TM) system.loadlibray() but got eventually the error...
...
[Loaded java.lang.UnsatisfiedLinkError from shared objects file] 
...

I have attached a benchmark taken from the archives...
http://cygwin.com/ml/cygwin/2003-02/msg02235.html
and run make test,

I wonder what is the missing command in the linker which allows JNI to
load all the cygwin objects?

Christian Montanari.
 

---HelloWorld.java---
public class HelloWorld
{
  private static String libraryName = Native;
 
  /**
   * Failure callback strategy that writes a message to sysout, then
   calls
   * System.exit(1). 
   */
  public static Runnable EXIT_JVM = new Runnable() {
public void run() {
  System.out.println(Could not load ' + libraryName + ');
  System.out.println(java.library.path =  
  + System.getProperty(java.library.path));
  System.exit(1);
}
  };
  public static Runnable THROW_ERROR = new Runnable() {
public void run() {
  throw new UnsatisfiedLinkError(Could not load ' + libraryName
  + ');
}
  };
  private static Object callbackLock = new Object();
  private static Runnable failureCallback = EXIT_JVM;

  private static native void sayHello();

  public static void main( String[] args )
  {
  try {
//System.loadLibrary( libraryName , true);
  System.loadLibrary( libraryName );
  } catch (UnsatisfiedLinkError e) {
synchronized (callbackLock) {
  if (failureCallback != null) {
   failureCallback.run();
 }
   }
  }
sayHello();
  }
}
--HelloWorld.c-
#include iostream
using namespace std;

#include HelloWorld_jni.h

JNIEXPORT void JNICALL
Java_HelloWorld_sayHello( JNIEnv *env, jclass c )
{
  cerr  Hello World from C!  endl;
}
--Makefile-just do make test
JAVA_HOME?='c:/PROGRA~1/Java/jdk1.6.0_24'
clean:
set nonomatch;\
rm -rf  ./bin Native.dll *.o *_jni.h

HelloWorld.class: HelloWorld.java
  javac HelloWorld.java

HelloWorld_jni.h :HelloWorld.class
 javah -classpath . -o HelloWorld_jni.h HelloWorld

Native.dll: HelloWorld.c HelloWorld_jni.h Makefile
$(CXX) \
  -D_REENTRANT -D_GNU_SOURCE -D__int64='long long'  \
-I${JAVA_HOME}/include -I${JAVA_HOME}/include/win32
-I. \
$ $(LDFLAGS) -o $@


Native.dll:LDFLAGS=-mno-cygwin
Native.dll:LDFLAGS=-shared 
Native.dll:LDFLAGS=-shared -Wl,--add-stdcall-alias
Native.dll:LDFLAGS=-shared
-Wl,--verbose,--warn-unresolved-symbols,--add-stdcall-alias
Native.dll:LDFLAGS=-shared
-Wl,--verbose,--warn-unresolved-symbols,--add-stdcall-alias,--add-indirect
Native.dll:LDFLAGS=-shared
-Wl,--verbose,--warn-unresolved-symbols,--add-stdcall-alias,--add-stdcall-underscore
Native.dll:LDFLAGS=-shared
-Wl,--verbose,--warn-unresolved-symbols,--add-stdcall-alias,--add-underscore
Native.dll:LDFLAGS=-shared
-Wl,--verbose,--error-unresolved-symbols,--add-stdcall-alias
--add-underscore
Native.dll:LDFLAGS=-shared
-Wl,--verbose,--error-unresolved-symbols,--add-stdcall-alias,--export-dynamic

Native.dll:CXX=
Native.dll:CXX=g++ --verbose

comma:= ,
semicomma:= ;
empty:=
space:= $(empty) $(empty)

test:LD_LIBRARY_PATH:=$(subst $(space),$(semicomma),$(addprefix
'c:/cygwin',/usr/lib/gcc/i686-pc-cygwin/4.3.4
/usr/lib/gcc/i686-pc-cygwin/4.3.4
/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../ /lib/ /usr/lib/))
test: Native.dll
  LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) java -verbose -classpath
  . -Xmx256m -Djava.library.path=. HelloWorld


ifneq (,)
 nm -u Native.dll 
 w __Jv_RegisterClasses
 w __ZdaPv
 w __ZdaPvRKSt9nothrow_t
 w __ZdlPv
 w __ZdlPvRKSt9nothrow_t
 w __Znaj
 w __ZnajRKSt9nothrow_t
 w __Znwj
 w __ZnwjRKSt9nothrow_t
 U ___crt_xc_end__
 U ___crt_xc_start__
 U ___crt_xi_end__
 U ___crt_xi_start__
 U ___crt_xl_start__
 U ___crt_xp_end__
 U ___crt_xp_start__
 U ___crt_xt_end__
 U ___crt_xt_start__
 U ___tls_end__
 U ___tls_start__
 U __end__
endif



--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



is BKDR_HACDEF.M found in c:\cygwin\bin\cygcrypt-0.dll for real?

2005-01-10 Thread Christian Montanari
Our local virus scan tool provided by * 
reported a trojan horse called BKDR_HACDEF.M found in 
c:\cygwin\bin\cygcrypt-0.dll

c.f.: 

http://www.**.com/vinfo/virusencyclo/default5.asp?VName=BKDR_HACDEF.M

Could you tell me what is your point of view about this ? is it a fluke 
information ?
does the code for cygcrypt-0.dll need to be checked against Easter-Eggs of this 
kind ?

Regards,


Christian Montanari,
SHARP TELECOMMUNICATIONS OF EUROPE Ltd.,
Azure House,
Bagshot Road,
Bracknell,
Berks, RG12 7QY, UK.
Tel: +44 (0) 1344 301883
Fax: +44 (0) 1344 300293



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



TCLTK:Re: couldn't load library ../libitcl32.a:invalid argument ...

2004-03-12 Thread Christian Montanari
On Wed, Mar 10, 2004 at 09:22:21AM +, Christian Montanari wrote:
 Hi,
 Any updates on this issue on package tcltk-20030901-1 ?
 Redhat stuff seems to work better (ie. like with the snavigator package). 
 what is the difference with this installation ?

replying to my own-self, to whom it concerns...

I carried a little research and I have found a few calls for this long running problem
with package tcltk-20030901-1 and earliers.
Back in March 2003 there was an answer on GMANE.CYGWYN.DEBUG.INSIGHT, 
but not really making sense to me.

I then debugged wish84g.exe, and found that libitcl32.a is an archives (!arch),
therefore can not be loaded as DLL using TclpDlopen,[EMAIL PROTECTED] (found in 
tclload.c),
then it come to light that the tcltk package must be constructed with:

./configure --enable-shared --enable-load; make all install

and finally a little:

cd /usr/local/lib; ln -s ../bin/*.dll .


It did the trick: now I can use iwidget, itcl, and others...
 
I am sure someone, somewhere knew it before me (sigh).
I do not know how to update packages or submit patches, so, I leave the info there.

Chao,
Christian Montanari.


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



couldn't load library ../libitcl32.a:invalid argument ...

2004-03-10 Thread Christian Montanari
Hi,
Any updates on this issue on package tcltk-20030901-1 ?
Redhat stuff seems to work better (ie. like with the snavigator package). 
what is the difference with this installation ?

Thanks,
-- 

Dr. Christian Montanari,
SHARP TELECOMMUNICATIONS OF EUROPE Ltd.,
Azure House,
Bagshot Road,
Bracknell,
Berks, RG12 7QY, UK.
Tel: +44 (0) 1344 301883
Fax: +44 (0) 1344 300293



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/