[Xcb] Native win32 port - progress :)

Jeetu Golani jeetu.golani at gmail.com
Thu Apr 10 09:45:22 PDT 2008


Hi everyone,

Peter:

> You seem to have trimmed the mailing list address. Was that intentional?

Oops :)....nope it wasn't intentional.....sorry..have pasted your response 
down below so all can follow since I noticed you replied back to my id too :)

Thanks a lot for your clarification.......yes I see your point on allocating 
memory with one C lib and deallocating with another....I had assumed that 
there was a mechanism within XCB for free.....will read up the thread on why 
it's considered bad for us.

In the meanwhile the Win32 port seems to be coming together quite 
decently.....the "flakiness" I had reported earlier has been resolved (I 
hope). I still need to lock down some more potential trouble spots and do 
stronger error checking and I want to do more extensive testing....I plan to 
run all the test code I can find in the tutorials to begin with.

For now I am feeling more and more confident that the thread synchronization 
issue we've discussed earlier has not made itself apparent (yet).....however 
it's too early to say.....more rigorous testing needs to be done.....I wonder 
how my port would work under load - multiple clients connecting to the same 
server through the library....should this affect things in any way? guess 
will try it too sometime later.

I don't know XCB that well so forgive me however if multiple clients connect 
to the same server....does XCB open multiple connections to the server or a 
single one......am not too clear on that.

Bye for now

----------  Forwarded Message  ----------

Subject: Re: [Xcb] Native win32 port - progress :)
Date: Thursday 10 Apr 2008
From: Peter Harris <peter.harris at hummingbird.com>
To: jeetu.golani at gmail.com

You seem to have trimmed the mailing list address. Was that intentional?

Jeetu Golani wrote:
>> Just a word of warning, since you're moving towards DLLs: On Win32, the
>> DLL's libc has to exactly match the application's libc. No mixing debug
>> and release builds, no mixing static libc with dynamic libc, and no
>> mixing compilers[1].
> 
>> [1] Not strictly true; I believe the MinGW/GCC compilers all use the
>> "VS6 Release DLL - MSVCRT.DLL", so those can be mixed. But each MS
>> compiler version has its own set of libcs. I'm not sure what the Intel
>> compilers do these days.
> 
> Peter thanks for writing in :).....I believe this issue diminishes when 
using 
> pure C since the libraries are more or less standardized and compatible.

Actually, I use only C, so I can't actually speak to any extra issues 
that are raised when using C++.

If you call malloc() in MSVCRT.DLL and free() in MSVCR80.DLL, you will 
eventually cause a segfault in the heap. They use mutually incompatible 
heap implementations. Ditto MSVCR70.DLL, MSVCR71.DLL, MSVCR90.DLL, the 
static versions of each of the above, the debug versions of each of the 
above, and the static-debug versions of each of the above.

It's a real pain.

> Since MinGW uses MSVCRT.DLL I don't think there's an issue 
> compiling a DLL within MinGW and using with within Visual Studio or a VS 
made 
> app.

Provided it's Visual Studio 6 (or, I believe 5 uses the same dynamic 
libc as 6), and you set it to use the release-dynamic libc, yes. 
Otherwise, no.

>> The problem would be reduced in scope if we had an xcb_free() (the way
>> Xlib has XFree()), but the designers of xcb believe that xcb_free() is
>> too ugly for words. 
> 
> I'm not sure I understand this problem....how would xcb_free/XFree help in 
DLL 
> and compiler related context of your post? My (limited) understanding of 
> XFree is that it is a cleanup function for memory and other X mechanisms. 

XFree is just a simple wrapper around free. (Actually, XFree is just a 
simple wrapper around Xfree, which is usually #defined to free).

http://gitweb.freedesktop.org/?p=xorg/lib/libX11.git;a=blob;h=f90f851120c359093a76fc1e93b5b905fb6f8780;hb=a19f9c65ee9e5e5d783feaa84998c36439b0288b;f=src/XlibInt.c
http://gitweb.freedesktop.org/?p=xorg/lib/libX11.git;a=blob;h=8aab764aaa5f9f1ace8d79a0757425b156ed0fb3;hb=a19f9c65ee9e5e5d783feaa84998c36439b0288b;f=include/X11/Xlibint.h

The problem goes away if you have (and correctly use) XFree() or 
xcb_free(), since the free() is done by the same library as the 
malloc(), inside your XLib or xcb DLL.

But adding xcb_free only for Win32 is almost pointless, since nothing 
will use it, so you'll still have to port everything.

> I've also jumped onto XCB a little late so I'm not aware of why this is a 
bad 
> thing for us......please point me to the right discussion threads if you 
can.

http://lists.freedesktop.org/archives/xcb/2007-December/003131.html and 
surrounding thread.

Peter Harris
-- 
      Hummingbird Connectivity - A Division of Open Text
Peter Harris                    http://connectivity.hummingbird.com
Research and Development        Phone: +1 905 762 6001
peter.harris at hummingbird.com    Toll Free: 1 877 359 4866

-------------------------------------------------------


More information about the Xcb mailing list