Comments (9)
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.
P.S. The binary public interface you are looking for is uiohook.h
from libuiohook.
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.
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.
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.
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.
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.
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.
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)
- [Feature Request] Gamepad support? HOT 1
- [Feature request] gamepads support?
- Can't type special characters with right alt HOT 3
- replace key ouput with other value HOT 11
- Caps lock can't be suppressed on Mac OS Monterey HOT 1
- Posting Keys Does Not Work in Games on Windows
- KeyTyped event wasn't emitted for @ on German keyboard layout HOT 10
- hook_create_screen_info doesn't work correctly on Windows when there are multiple screens HOT 1
- Darwin Segfualt on CGEventTapCreate failure
- [Feature Request] Add support for Mac Catalyst HOT 8
- Address issues with Windows hook restarts HOT 2
- coordinates multiplied by two for the mouse on windows HOT 9
- error in the readme HOT 1
- Add keychar support to press and release HOT 2
- Remap a keyboard key as a left mouse button unable to register a double click HOT 1
- Getting mouse position without listening to an event. HOT 4
- add libuiohook as a package on xmake-repo HOT 2
- `keycode` does not match (all?) definitions from `uiohook.h` on Windows HOT 7
- Help for Compiling on Windows HOT 3
- The KEYEVENTF_EXTENDEDKEY flag is not added to every key that needs it when simulating keyboard events on Windows HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libuiohook.