Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack on java  (Read 870 times)

zwei

  • Bay Watcher
  • [ECHO][MENDING]
    • View Profile
    • Fate of Heroes
DFHack on java
« on: February 05, 2010, 08:18:06 am »

Hello,

I would like to write my own utility for DF using DFhack library ... in java.

I wonder, did anyone implement JNI bridge for it? Or even try? C++ support in automated tools is abyssmal and I have "absolutelly detests c" trait so decrypting interface and writing mapping manually is, while certainly possible, giving me bad thoughts that cannot be offset by legendary dining rooms...

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFHack on java
« Reply #1 on: February 17, 2010, 10:04:44 pm »

Well, no. Or not yet anyway. From what I read about JNI, it seems that it would be very hard to make this work.

zwei

  • Bay Watcher
  • [ECHO][MENDING]
    • View Profile
    • Fate of Heroes
Re: DFHack on java
« Reply #2 on: February 19, 2010, 10:10:41 am »

Well, no. Or not yet anyway. From what I read about JNI, it seems that it would be very hard to make this work.

I did some research and gave it another try.

As i understand it, DFhack inreface is object oriented and any client program has to make instance of dfhack object and keep reference to that object to make calls.

While this is good design practice, this invalidates JNI which is focused on making calls to just plain functions.

I wonder, how feasible it is to make function-only interface over dfhack?

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFHack on java
« Reply #3 on: February 19, 2010, 04:43:05 pm »

There was one already. I deprecated it because nobody used it and it was a pain to keep it in sync with the real C++ interface... lots of boilerplate code. It should be possible to dig it out of the svn or git history though. Certainly feasible. It just has to be easy to maintain.

mizipzor

  • Bay Watcher
    • View Profile
    • Blog
Re: DFHack on java
« Reply #4 on: February 19, 2010, 04:50:45 pm »

Im trying another approach to bindings. I want to make the tools in dfhack to have powerful command line options, so instead of interfacing directly with the api, you call the compiled/binary tools. I think this is the way that the Git Gui handles things, and similiar guis-that-wrap-console-programs. Could be worth a shot, Im soon done with my treecutter so I will try to add a Gui to that.
Logged