caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] camljava inside a toplvel ?
@ 2003-07-23 13:09 EL CHAAR RABIH
  2003-09-05 18:51 ` [Caml-list] " Gregoire Henry
  0 siblings, 1 reply; 2+ messages in thread
From: EL CHAAR RABIH @ 2003-07-23 13:09 UTC (permalink / raw)
  To: 'caml-list@inria.fr'

Hello,
i'm working with camljava (Xavier Leroy) to call java classes via caml.

It uses jni and c-caml callbacks to achieve this.

A library jni.cma, which permits caml to  achieve this.
In the test package, we have a jnitest.ml, and 2 java classes.

The creation of an executable via ocamlc works fine

ocamlc -I +camljava jni.cma jnitest.ml

launching the executable

CLASSPATH="." ./camlprog works fine.

I'm trying to execute directly the jnitest.ml via the ocaml toplevel.

I've tried doing the following
ocaml -I +camljava jni.cma jnitest.ml but it doesn't work, and i have an
error message that some external functions are not here
The external function `camljava_AllocObject' is not available

If i understand the problem, since these functions are declared as external,
i've tried to build a new toplevel, ocamljni which supports them.
Unfortunately, things don't seem to be that easy.

To achieve jni.cma, we have jni.ml, jni.mli and jnistubs.c

jni.ml is compiled into a jni.cmo
jnistubs.c is compiled into jnistubs.obj

jnistubs.obj is put into library libcamljni.lib

jni.cmo and libcamljni.lib enter in the creation of jni.cma.

I've tried following the same approach, using libcamljni.lib and jni.cmo for
creating the ocamljni toplevel.
when i'm trying to do this
ocamlmktop -verbose -o ocamljni -linkall -custom jni.cmo -cclib -lcamljni
-cclib D:/APPLI/j2sdk1.4.1_01/lib/jvm.lib i'm having the following exception
in the linking process (CL)

+ cl /nologo /MT /Fe"mlfijni.exe" -I"D:\APPLI\MLFi\lib"
c:\TEMP\camlprimcd1cd1.c "libcamljni.lib" "D:/APPLI/j2sdk1.4.1_0
1/lib/jvm.lib" "D:\APPLI\MLFi\lib\libcamlrun.lib" advapi32.lib
camlprimcd1cd1.c
camlprimcd1cd1.obj : error LNK2001: unresolved external symbol
_camljava_CallStaticCamlintMethod
mlfijni.exe : fatal error LNK1120: 1 unresolved externals
Error while building custom runtime system

The function camljava_CallStaticCamlintMethod is defined inside jnistubs.c,
and should be therefore present inside libcamljni.lib.

Am i missing something ??

Thanks in advance for your help.



*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
SG Asset Management et ses filiales declinent toute responsabilite au titre
de ce message s'il a ete altere, deforme ou falsifie.

Découvrez l'offre et les services de SG Asset Management sur le site
www.sgam.fr 

				********

This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SG Asset Management nor any of its subsidiaries or affiliates shall
be liable for the message if altered, changed or falsified. 

*************************************************************************



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Caml-list] Re: camljava inside a toplvel ?
  2003-07-23 13:09 [Caml-list] camljava inside a toplvel ? EL CHAAR RABIH
@ 2003-09-05 18:51 ` Gregoire Henry
  0 siblings, 0 replies; 2+ messages in thread
From: Gregoire Henry @ 2003-09-05 18:51 UTC (permalink / raw)
  To: caml-list

Hello,

I've got the same within Linux.

It's just a "typo" in 'jnistubs.c' file :

line 389 the function should be called : camljava_CallStaticCamlintMethod
instead of :
camljava_CallStaticCamlIntMethod

with a lower 'i' in Camlint

Then :

$ ocamlmktop -o ocamljni -I +camljava jni.cma
$ ./ocamljni -I +camljava

should work.

regards,
Gregoire Henry


EL CHAAR RABIH wrote:
> Hello,
> i'm working with camljava (Xavier Leroy) to call java classes via caml.
> 
> It uses jni and c-caml callbacks to achieve this.
> 
> A library jni.cma, which permits caml to  achieve this.
> In the test package, we have a jnitest.ml, and 2 java classes.
> 
> The creation of an executable via ocamlc works fine
> 
> ocamlc -I +camljava jni.cma jnitest.ml
> 
> launching the executable
> 
> CLASSPATH="." ./camlprog works fine.
> 
> I'm trying to execute directly the jnitest.ml via the ocaml toplevel.
> 
> I've tried doing the following
> ocaml -I +camljava jni.cma jnitest.ml but it doesn't work, and i have an
> error message that some external functions are not here
> The external function `camljava_AllocObject' is not available
> 
> If i understand the problem, since these functions are declared as external,
> i've tried to build a new toplevel, ocamljni which supports them.
> Unfortunately, things don't seem to be that easy.
> 
> To achieve jni.cma, we have jni.ml, jni.mli and jnistubs.c
> 
> jni.ml is compiled into a jni.cmo
> jnistubs.c is compiled into jnistubs.obj
> 
> jnistubs.obj is put into library libcamljni.lib
> 
> jni.cmo and libcamljni.lib enter in the creation of jni.cma.
> 
> I've tried following the same approach, using libcamljni.lib and jni.cmo for
> creating the ocamljni toplevel.
> when i'm trying to do this
> ocamlmktop -verbose -o ocamljni -linkall -custom jni.cmo -cclib -lcamljni
> -cclib D:/APPLI/j2sdk1.4.1_01/lib/jvm.lib i'm having the following exception
> in the linking process (CL)
> 
> + cl /nologo /MT /Fe"mlfijni.exe" -I"D:\APPLI\MLFi\lib"
> c:\TEMP\camlprimcd1cd1.c "libcamljni.lib" "D:/APPLI/j2sdk1.4.1_0
> 1/lib/jvm.lib" "D:\APPLI\MLFi\lib\libcamlrun.lib" advapi32.lib
> camlprimcd1cd1.c
> camlprimcd1cd1.obj : error LNK2001: unresolved external symbol
> _camljava_CallStaticCamlintMethod
> mlfijni.exe : fatal error LNK1120: 1 unresolved externals
> Error while building custom runtime system
> 
> The function camljava_CallStaticCamlintMethod is defined inside jnistubs.c,
> and should be therefore present inside libcamljni.lib.
> 
> Am i missing something ??
> 
> Thanks in advance for your help.
> 
> 
> 
> *************************************************************************
> Ce message et toutes les pieces jointes (ci-apres le "message") sont
> confidentiels et etablis a l'intention exclusive de ses destinataires.
> Toute utilisation ou diffusion non autorisee est interdite. 
> Tout message electronique est susceptible d'alteration. 
> SG Asset Management et ses filiales declinent toute responsabilite au titre
> de ce message s'il a ete altere, deforme ou falsifie.
> 
> Découvrez l'offre et les services de SG Asset Management sur le site
> www.sgam.fr 
> 
> 				********
> 
> This message and any attachments (the "message") are confidential and
> intended solely for the addressees.
> Any unauthorised use or dissemination is prohibited. 
> E-mails are susceptible to alteration.   
> Neither SG Asset Management nor any of its subsidiaries or affiliates shall
> be liable for the message if altered, changed or falsified. 
> 
> *************************************************************************
> 
> 
> 
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> 


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-05 19:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-23 13:09 [Caml-list] camljava inside a toplvel ? EL CHAAR RABIH
2003-09-05 18:51 ` [Caml-list] " Gregoire Henry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).