[Blend2cs-user] Bugfix and Patch for compiling blend2cs on Win with MSVC6

Matze Braun blend2cs-user@blender.org
Tue, 30 Sep 2003 16:13:26 +0200 (CEST)

On Mon, 29 Sep 2003, Fritz Elfert wrote:

> Hi,
> I am currently writing a Win GUI frontend (MFC-based) for blend2cs for 
> some "KlickiBunti" Users. In order to get a working WIN32 version, i 
> patched blend2cs to compile with MSVC 6. During tests, i also found a 
> strange bug where the double linked list of BLStructs sometimes is
> corrupted (never saw this on Linux). Anyway ... patch is attached. All 
> WIN32-related stuff is if(n)def'd with _WIN32, _except_ the following:
Nice, I just tried to incorporate your stuff into blend2cs cvs.

>  - Added error checks for all malloc() calls.
>  - In Blend2CS::writePolygons(), use a different name for the
>    Mesh::PolygonIterator. (i is hidden later by 2 declarations in
>    for(...) loops and MSVC doesn't get that right. But IMHO using a
>    different name increases readability of the code anyway.
this is of course ok in this case, though I can't really guarantee that 
I'll remember this each time I'll code on blend2cs... (msvc7 does this 
thing right anyway AFAIK). 

>  - The fix for the above mentioned bug: In BLNewStruct(), initialize
>    prev and next pointers.

I changed the way the patch works, as I'd like to avoid scattering #ifdef 
WIN32 accross the code which makes it unreadable and probably hard to 
guess for non msvc coders what is happening. Also I renamed some #ifdefs 
to #ifdef MSVC, since on mingw and cygwin you have gcc compiler with win32 
To build the current stuff in cvs with msvc you should add the msvc 
directory to your include path so that the config.h file in there used. I 
did all these changes blindly on linux, the code still compiles on gcc, 
but you should test on msvc if I did everything right. Please report any 
issues that remain to me.
(And feel free to contribute msvc makefiles, or at least a small text on 
how to create some, I'm sure this will help others).

> The patch is against current CVS.
> To the developers:
> When finished with the GUI, i would like to contribute it. Is it
> possible to get CVS write-access for that? (Everything is in a new subdir 
> "win32")
Well I think we should create a separate project or cvs module for that. 
Anyway Frank should be able todo that.