Giter VIP home page Giter VIP logo

Comments (9)

kwhat avatar kwhat commented on May 13, 2024

Hi @ufoscout,

I have no idea how to use a C library with GoLang ;) I do know that you cannot use the binary from JNativeHook because it has been linked against the Java runtime. You should be able to compile this library using autotools without to much trouble. For more compilation instructions, you can follow the Wiki article from JNativeHook and just skip the Java portions. Let me know if you have issues or need further assistance.

Best,
Alex

from libuiohook.

kwhat avatar kwhat commented on May 13, 2024

P.S. The binary public interface you are looking for is uiohook.h

from libuiohook.

ufoscout avatar ufoscout commented on May 13, 2024

Hi @kwhat
the wiki page you linked explains how to build JNativeHook with ant, but if follow that process don't have I the same issue you mentioned about the library being linked against the Java runtime?

from libuiohook.

kwhat avatar kwhat commented on May 13, 2024

You dont need the ant part, just the dependencies like gcc or other C99 compiler, autotools, pkgconfig & libtool for your platform. After you have installed what is required for your platform, you should be able to run the 3 commands in the read me to compile. All of the default options will be selected for you; you can customize the build using --enable / --disable or --with / --without. Use ./configure --help for a list of options.

./bootstrap.sh
./configure
make

from libuiohook.

ufoscout avatar ufoscout commented on May 13, 2024

Hi @kwhat
thanks for your help, I was able to compile it on my machine and to link it dynamically.
I saw that the build instructions for JNativeHook include cross compilation options; is it possible to crosscompile this library passing some special flags to the make file?
For example, something like:

./bootstrap.sh
./configure
make --target=windows

from libuiohook.

kwhat avatar kwhat commented on May 13, 2024

Hi @ufoscout,

Cross compiling is far more challenging than targeting your local platform. Lets start with the easy stuff, you can switch between x86 / amd64 on a 64 bit system that supports 32 bit execution with -m. For compiling between platforms (Ex: from Windows to OS X) you will need the development headers and libraries for that platform in the architecture you are targeting. Note, this is easier on some platforms and difficult on others. After you have the required development libraries installed, you will need a compiler that can target (build for) the architecture you want to build for. Usually this compiler is compiled from source to run on one architecture and compile programs for another. GCC is the most commonly used, although technically any compiler would do. For example, I also use LLVM+CLANG to target OS X. Finally, you will need a linker that can create the container format required. Binutils provides a linker for most Linux supported architectures, MinGw will provide most of your Gcc for Windows needs and finally I use a Linux ported version of Apple open source linker from XCode Tools. https://github.com/kwhat/binutils-apple

I do most of my cross compiling on Gentoo Linux as they have many tools to help with this process, some of which are also in my repository.

Hope that helps.
Alex

from libuiohook.

ufoscout avatar ufoscout commented on May 13, 2024

Hi @kwhat

you are providing a great support but I understood that cross compiling is too far from my actual level...
However, thanks to your help I was able to compile it on Windows and Linux. Here a step by step beginner guide to compile this library in Windows if someone needs it:

  • Download and install msys2 ( http://www.msys2.org/ )
  • Open the msys2 console
  • Update the package database and core system packages:
    pacman -Syu
  • Update other packages (better to restart before):
    pacman -Su
  • Install required packages:
    pacman -S autoconf automake-wrapper gcc libtool make pkg-config git
  • clone the uiohook repository somewhere:
    git clone https://github.com/kwhat/libuiohook.git
  • enter the libuiohook folder and start the build process:
    ./bootstrap
    ./configure
    make
    
  • the build library is in the .libs folder

One question:

you can switch between x86 / amd64 on a 64 bit system that supports 32 bit execution with -m

how should I use the "-m" option? something like: make -m32?

from libuiohook.

ufoscout avatar ufoscout commented on May 13, 2024

Now I have another issue :(
When I use the dll that I build on Windows, it fails with this error message:
"The program can't start because msys-2.0.dll" is missing from your computer"
I guess that this means that if I compile it in MSYS2 then I can use it only in MSYS2, am I wrong? How can I build it in a portable way that has no external dependency?

from libuiohook.

kwhat avatar kwhat commented on May 13, 2024

Hi @ufoscout,

For the first post, you probably want to use the mingw32 and mingw64 consoles to compile. This should also solve the msys-2.0.dll problem. The -m options are just like you described.

from libuiohook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.