ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: dll loading problem
Date Mon, 06 Sep 2004 14:15:01 GMT
Yukelson, Dmitry wrote:
> Hi all,
> 
> I'm trying to create an interactive application which compiles ant file, and does several
other things.
> For this purpose I'm using Project and ProjectHelper ant classes.
> In addition, I defined my own ant Task, which used native code:
> 
> public class IdentityTask extends MatchingTask {
>  ....
> 	private native boolean CallIdentity();
> 
> 	static {
> 		System.loadLibrary("...");
> 	}
> .....
> }
> 
> 
> The first compilation is succeeded without any problems, the dll is loaded and the native
code is called. But when the second compilation request is processed, the following exception
is thrown:
> 
>>>>>sample.xml java.lang.UnsatisfiedLinkError: Native Library .... already
loaded in another classloader

It sounds we you need some way of unloading a task & native library. I 
dont think there is one yet, and even if we have a way to undeclare 
tasks (thoughts, anyone?), you are potentially still at the mercy of the OS.

The only way that I know to safely work with native libs is to load them 
in a forked java process. You could do that under ant -if the invocation 
is one way provide a new main() which takes args to call the native app. 
If you have two way comms you need to use rmi or send serialised objects 
over stdio.

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message