Xlib and assembly?
Xlib and assembly?
Anyone got experience with Xlib/xcb for linux and assembly? basically i would like to start "hacking" http://incise.org/tinywm.html but dont know how to link / compile to the lib
re
skid
re
skid
Re: Xlib and assembly?
I'm not quite sure that I understand what your problem is. You call Xlib functions just like you would any other library. Or am I missing something?
Re: Xlib and assembly?
care to give an example, i've been out of the game for quite som time and become literally stupid
-
- Member
- Posts: 307
- Joined: Wed Oct 30, 2013 1:57 pm
- Libera.chat IRC: no92
- Location: Germany
- Contact:
Re: Xlib and assembly?
Asking for the solution is not something that makes you look good. It makes you look like a complete idiot. As someone has in his sig, computer science is all about problem solving. By asking for the solution, you're basically defeating the purpose. Even if this does not reflect this case, it shows you one thing: we only provide help that helps you to find the solution by yourself.
Take a look at the System V ABI. It tells you how to call a function. If you're not familiar with gcc or ld, there's nothing for you to do here. Go learn to use it first (e.g. by taking a look at the man pages ...). I'm sorry if it sounds very rude, but that's the truth.
Take a look at the System V ABI. It tells you how to call a function. If you're not familiar with gcc or ld, there's nothing for you to do here. Go learn to use it first (e.g. by taking a look at the man pages ...). I'm sorry if it sounds very rude, but that's the truth.
Re: Xlib and assembly?
In general, if I were interested in using X11, I would start studying the X Window System Protocol.
I am not interested using it (and I am no familiar with it) but I kind of like these kind of interfaces. There are no specific programming languages involved. Send an opcode and then parameters into some messaging system...
Code: Select all
ChangeWindowAttributes
1 2 opcode
1 unused
2 3+n request length
4 WINDOW window
4 BITMASK value-mask (has n bits set to 1)
encodings are the same as for CreateWindow
4n LISTofVALUE value-list
encodings are the same as for CreateWindow
I am not interested using it (and I am no familiar with it) but I kind of like these kind of interfaces. There are no specific programming languages involved. Send an opcode and then parameters into some messaging system...
Re: Xlib and assembly?
TBH, if you are not up to reading and understanding the X Window and Xlib documentation then you are not going to have much success "hacking" a window manager. Start with something simpler and practise calling C libraries from assembler. When you are confident with that you can come back to using this particular library.skid wrote:care to give an example, i've been out of the game for quite som time and become literally stupid
Re: Xlib and assembly?
i get the picture and i think i understand but could someone please give me an idea howto build the structure for Display for example, guess one way would be to put extern Display * dpy in a c file and link, but i want to learn but i dont understand. i'm not asking for anyone to write me an entire program here, only minor guidance, and explain in a language i can understand or begin to understand. i used to do dos assembly years ago, i'm sorry i have blown my brains on dope...
http://www.x.org/releases/current/doc/x ... tion_Setup
what am i supposed to to with this, a snippet is all i ask.
http://www.x.org/releases/current/doc/x ... tion_Setup
what am i supposed to to with this, a snippet is all i ask.
-
- Member
- Posts: 283
- Joined: Mon Jan 03, 2011 6:58 pm
Re: Xlib and assembly?
Everything you need to know is at http://www.cprogramming.com/skid wrote:i get the picture and i think i understand but could someone please give me an idea howto build the structure for Display for example, guess one way would be to put extern Display * dpy in a c file and link, but i want to learn but i dont understand. i'm not asking for anyone to write me an entire program here, only minor guidance, and explain in a language i can understand or begin to understand. i used to do dos assembly years ago, i'm sorry i have blown my brains on dope...
http://www.x.org/releases/current/doc/x ... tion_Setup
what am i supposed to to with this, a snippet is all i ask.
- Monk
Re: Xlib and assembly?
You are not asking how to use Xlib or how to do XWindow programming. You are asking how to use any external C function or library from assembler (in this case how to build the assembler equivalent of a C struct). This is not really the level that this forum is aimed at.skid wrote:i get the picture and i think i understand but could someone please give me an idea howto build the structure for Display for example, guess one way would be to put extern Display * dpy in a c file and link, but i want to learn but i dont understand. i'm not asking for anyone to write me an entire program here, only minor guidance, and explain in a language i can understand or begin to understand. i used to do dos assembly years ago, i'm sorry i have blown my brains on dope...
http://www.x.org/releases/current/doc/x ... tion_Setup
what am i supposed to to with this, a snippet is all i ask.
I repeat my previous advice - before being so ambitious learn and practise the basics with simpler C libraries. Once you understand them you can return to this more advanced project. There are plenty of web sites and/or books that will provide help with these basics of assembler programming.
Re: Xlib and assembly?
am i on the right path atleast?
Code: Select all
extern XOpenDisplay
extern DefaultRootWindow
push 0
call XOpenDisplay
or eax, eax
je fail
;add esp, 4
mov [display], eax
push display
call DefaultRootWindow
;add esp, 8
mov [root], eax
fail:
; print something
display dd 0
root dd 0
Re: Xlib and assembly?
A good way to check what you need to do in assembler is to create a simple program in C and compile it. Look at the assembler output produced.
A better way is just to use C in the first place.
A better way is just to use C in the first place.