Calling C code from server-side javascript/java in Xpages? -


I am trying to call some third-party C code from the X page in the IBM Domino. I have a button in which there is an EventHandler whose action creates a Java object and then tries to execute a method, which tries to load and run simple test C function (via JNA) in a DLL. . (It's running under Windows 7.) Here's the Java code:

  enhances the interface Clarbury StdCallLibrary {int hello (); } Public class MyHelloWorld {Public Zero Test Image (CLUBURN INSTANCE2 = (Cilabari) Native.loadLibrary ("Hello World", CLibrary.class); INSTANCE2.hello ();  

And here is the code:

  #include & lt; Stdio.h & gt; Int Hello () {printf ("Hello World! \ N"); }  

I have compiled the C code in DLL, and I have Dll has been imported as resource-> files designer. I have also put the jna.jar file in the ext directory on the server. When I try to run all this, I get a 500 error. There is a lot going on here, so I'm not sure what the problem is. The logfile does not appear much. Has anyone done it before? In short, I want to be able to become XPage-> Java-> C thank you! Coincidentally, I did the same yesterday with Expages, JNA and nnotes.dll.

I suspect that your library is not loading in the load library stage.

The nnotes.dll can be loaded from the Exposure without any additional setup, possibly because it is on the system path, although in your case you are supplying your own DLL, and I'm pretty sure It is not that your DLL will be found in resources - during the File Section Loader () phase.

If you have not read this article by Jester Care, then read that article, and then see an example of your NSFDbSpaceUsage, but do it in an XPage. (He does in a Java agent, but instead does it in an Expand). The way you know that JNA is working with XPages is OK.

Once working, can I verify that it works in isolation, without any notes / domino insertions? You can set the property jna.library.path to add the custom place of DLL. If you have set the property to jna.debug_load = true , then you can see in the console that the JNA is looking for the path to your DLL, by default it is the system path and some If you can not get this, you will get dissatisfied links, so keep playing with the library path until you load your DLL. At least you will know that there is nothing wrong in your DLL and JNA. (If you do not want to test separate Java Java applications, you may also be able to set those properties dynamically in your own speed.)

Then play DLL's place in the last step Try using Jna.library.path to load it in your xpages, try standard locations, to read the loadLibrary method, find out where the default location is.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -