All Forums |
Register |
Login |
Search |
Subscriptions |
My Profile |
Inbox |
Tool Warehouse |
FAQs |
Resources |
Help |
Member List |
Address Book |
Logout |
|
|
problem running JNI in SFU
|
Logged in as: Guest |
Users viewing this topic: none |
|
Login |
|
|
problem running JNI in SFU - Feb. 17, '04, 1:29:30 PM
|
|
|
Vladimir Putin
Posts: 4
Joined: Feb. 17, '04,
Status: offline
|
Hello all!
I have a problem with running Java application with JNI native code compiled with Interix GNU SDK.
When running the application it fails with
" java.lang.UnsatisfiedLinkError"
I think it caused by wrong shared library format that generates Interix SDK.
So the question is: how to create valid .DLL using Interix GNU SDK?
Best regards,
Vlad.
|
|
|
RE: problem running JNI in SFU - Feb. 17, '04, 1:52:51 PM
|
|
|
Rodney
Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
|
You cannot use Interix DSO (shared libraries) with Win32.
Win32 DLL cannot be used by Interix applications either.
Are you trying to use the build environment of Interix to drive the creation of your Java application as a Win32 binary?
That is, use Unix ' make' to create Win32 object files?
|
|
|
RE: problem running JNI in SFU - Feb. 18, '04, 8:40:43 AM
|
|
|
Vladimir Putin
Posts: 4
Joined: Feb. 17, '04,
Status: offline
|
I have C code compiled only by GCC and using some GCC libraries (bfdlib, etc.) Then I have to call C functions from Java frontend using JNI tecnology. To do this all C objects have to be compiled into .dll shared library and Java VM will be able to link with it.
This task successfully solved in Cygwin (at least in early version 1.3), I need only to link C code with some special options (-shares -Wl,add_stdcall_alias). Unfortunately these options do not work in Interix gcc.
|
|
|
RE: problem running JNI in SFU - Feb. 18, '04, 10:38:48 AM
|
|
|
Rodney
Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
|
Cygwin is a different beast under the covers. It' s a Unix emulation that runs on Win32. So all of it' s " system" API calls resolve to functions that emulate by using Win32 system calls. So none of the Cygwin system API calls are native. The result is the Cygwin binaries are Win32 binaries.
Interix is its own subsystem running above the NT kernel. It' s a peer to the Win32 subsystem (CSRSS). So the Interix system API calls are native. The Win32 API' s aren' t used to emulate anything. The binaries are labeled Interix/posix.
The gcc options you mention are Cygwin specific extentions.
There is no " cross-calling" of the binary types for API' s.
There are solutions for other inter-dependent programs such as sockets, shared files, memory mapping and products like the ODBC-ODBC bridge.
|
|
|
RE: problem running JNI in SFU - Feb. 18, '04, 11:35:23 AM
|
|
|
Vladimir Putin
Posts: 4
Joined: Feb. 17, '04,
Status: offline
|
Yes, I understand.
But now I try to create .dll library by using VC linker but I have problems.
There is no problems to link simple example archived to .a library with VC application, but for my application I got many problems with symbols resolving (for example I can' t found _errno neither in .a files nor .lib files from Interix distribution).
|
|
|
RE: problem running JNI in SFU - Feb. 18, '04, 12:49:21 PM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
That' s because errno is defined in crt0.o.
What is it you are trying to do now ? Build an Interix application using the VC IDE tools ? If so, look in the /bin/cc script to see what the compiler/linker options are.
|
|
|
RE: problem running JNI in SFU - Feb. 19, '04, 8:11:51 AM
|
|
|
Vladimir Putin
Posts: 4
Joined: Feb. 17, '04,
Status: offline
|
I trying to build .dll because Java VM links with it.
Well, I found -G option in /bin/cc script that is intended to use to link DLL library. However /bin/cc has following description:
G)
mkDll=true
#
# DllMainCRTStartup is a function that we (OpenNT) must
# define and put in a static library that links with
# DLL' s (when the -G option is specified)
# This function must do C++ runtime startup for the DLL
# before calling the user' s DllMain
entryPoint=" /entry:_DllMainCRTStartup"
set -A ldoptions ${set_args} " ${ldoptions[@]}" " -dll"
;;
Unfortunately I cannot found DllMainCRTStartup in Interix libaries. If I also link with this option (-G) and crt0.o symbol _main is unresolved.
So I beleive support of -G option in /bin/cc in incomplete,
at least DllMainCRTStartup intended to perform C runtime actions for attaching and detaching processes to DLL is unimplemented.
|
|
|
RE: problem running JNI in SFU - Feb. 19, '04, 9:45:56 AM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
You shouldn' t use /bin/cc to build anything for use outside an Interix environment.
If you' re still trying to build something for the Java VM, then use the Windows compiler and SDK tools.
Do not use the Interix SDK tools. They are not designed for building Win32 objects.
The -G option is very, very old code. It was something I was experimenting with before Interix. Before Interix had .so support. I don' t remember if I actually got it to work. Which is why you won' t find this option documented anywhere.
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
|
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|
|