X-Winoows under (Microsoft(R))-windows

174 views
Skip to first unread message

mau...@murus.org

unread,
Feb 11, 2014, 2:05:46 PM2/11/14
to golan...@googlegroups.com
In the appendix, there is a win.c, a very small C-program, that draws under X a little window to the screen
(make it with "gcc -o win win.c -lX11").

And there is the corresponding Go program win.go.

Under Linux - both programs work perfectly.

But, when I try to compile win.go on _Windows_ (using MinGW and XMing), the MinGW-gcc
gives errors of the type "undefined ..." (where ... are the names of used functions).

Now comes the QUESTION:

Who has an idea, what to do, to get win.go compiled and run under Windows ?

Any help or hint is welcome !

Greetings, Christian

win.c
win.go

Daniel Theophanes

unread,
Feb 11, 2014, 2:10:19 PM2/11/14
to golan...@googlegroups.com
Windows doesn't use X11. You'll need to use a cross platform library to do this for you.

Tamás Gulácsi

unread,
Feb 11, 2014, 3:28:27 PM2/11/14
to golan...@googlegroups.com
He uses XMing, but fail to set CFLAGS, LDFLAGS properly.

Andrew Gallant

unread,
Feb 11, 2014, 9:32:49 PM2/11/14
to golan...@googlegroups.com
If you have an X server running, then you can use XGB[1], which is a pure Go implementation of the X client protocol. (Plus some extensions.)

There is also xgbutil[2], which tries to offer some of the functionality of Xlib. There are lots of examples included as well.

mau...@murus.org

unread,
Feb 12, 2014, 8:08:25 AM2/12/14
to golan...@googlegroups.com
Sorry - my fault - misprint - of course not X-Winoows, but X-Windows ...

mau...@murus.org

unread,
Feb 12, 2014, 8:10:03 AM2/12/14
to golan...@googlegroups.com

mau...@murus.org

unread,
Feb 12, 2014, 8:11:49 AM2/12/14
to golan...@googlegroups.com
Dear Tam'as,

do you have any idea, how to set them properly ?

Kind regards, Christian

mau...@murus.org

unread,
Feb 12, 2014, 8:16:23 AM2/12/14
to golan...@googlegroups.com
Dear Daniel,

I thought, XMing does this job (transmitting to X11).

Do you have any idea, where to find such a "cross platform library" ?

Kind regards, Christian

Carlos Castillo

unread,
Feb 12, 2014, 3:56:10 PM2/12/14
to golan...@googlegroups.com
Windows can run an X-Windows server, as can the Mac OS. X11 is merely a specification/protocol that allows a client program to present visual information through an X-Windows server.

There are downside to using it to create windows/mac programs:
  • you probably won't get a true "native" look and feel, so you may confuse/offend your users
  • the servers are not standard on these OS's, so the user has to install them themselves
  • the level of support for X-Windows features is much lower, so some features may be significantly crippled (eg: slower, buggy), possible to the point of not being usable at all, or are flat-out missing
  • interoperability with "native" apps is also probably more difficult for some gui tasks (eg: drag'n'drop)

Ian Davis

unread,
Feb 12, 2014, 6:41:15 PM2/12/14
to golan...@googlegroups.com
 
On Wed, Feb 12, 2014, at 01:16 PM, mau...@murus.org wrote:
Dear Daniel,
 
I thought, XMing does this job (transmitting to X11).
 
Do you have any idea, where to find such a "cross platform library" ?
 
You might find go.wde useful. It supports Windows, Mac and Linux and give basic windowing and events.
 
 
Ian

Carlos Castillo

unread,
Feb 12, 2014, 6:43:30 PM2/12/14
to golan...@googlegroups.com
Setting them properly means that since the compiler or the linker can't seem to find what they're looking for, you will need to set command line flags in the CFLAGS/LDFLAGS options using either cgo directives, or environment variables.

If you want more help, a first good step would be to find where the X11 headers and library were installed to and possibly where your compiler is.

Can you compile the C code on your windows machine? If you can, compare the commands and results to what the go tool is doing (by passing the -x flag to go build/install/run/test).
Reply all
Reply to author
Forward
0 new messages