CFLite old
This page documents how to build CFLite 476.10 such that you can then link to it in your Windows projects, and then blissfully use CFStrings, CFDictionaries, and all the other CFGoodness that CFLite will bring you. For a "quick and dirty" way to just start *using* CFLite on windows (without having to compile it), click here.
On Windows XP or Windows Vista:
- Download ICU4C
- Download CFLite 476.13. Ooops! Not available? Try: CFLite 476.10
- Get FreeBSD's flsl.c source file
- Download include.zip (contains /usr/include/*, which includes AvailabilityMacros, AssertMacros and TargetConditionals from 10.5)
- If you're using Microsoft Visual Studio, you'll need stdint.h and stdbool.h They don't come with the compiler but are part of the C99 standard.
- You will need the contents of mach/*, i386/*, malloc/malloc.h, and sys/cdefs.h from xcode 3.0
- Install Cygwin - select (add them by clicking the text labelled Skip) these packages during the install:
- Devel/gcc-core
- Devel/gcc-objc
- Devel/make
- If you want to debug the dll, also install Devel/gdb.
- When you first run cygwin, it may notify you that it needs you to build /etc/passwd and /etc/group. Do this. Your cygwin setup should be ready.
- Arrange the source files. This layout is the format that the patch understands.
- Extract CF-Lite to a place of your choosing. You'll need to get to the directory easily from cygwin, so make it somewhere easy.
- Open the directory where you extracted CF-Lite.
- Remove the files: xyzzy . The patch does not yet cover these source files and their contained features.
- Copy flsl.c into your CFLite folder.
- Create a folder named include, in the CF-Lite folder.
- Open the include folder that you just made.
- Copy the files stdint.h, stdbool.h, AvailabilityMacros.h, AssertMacros.h, and TargetConditionals.h into this include folder.
- Extract the ICU4C package in the include folder. It should extract into an icu folder.
- Create a folder named malloc. Copy XCode's /usr/include/malloc/malloc.h into this folder.
- Create a folder named sys. Copy XCode's /usr/include/sys/cdefs.h into it.
- Copy XCode's /usr/include/mach and /usr/include/i386 folders into your include folder.
- Navigate to the folder where you extracted CF-Lite on your Cygwin command prompt.
- Cygwin maps disk drive letters to a mount point in the folder /cygdrive/. For example; /cygdrive/c/ is equivalent to C:\, and /cygdrive/m/ would be M:\ at a DOS prompt or under My Computer.
- Apply the patch. The patch is a patch against CFLite-476.13. Where to host patch?
- Run make. Just type make.
- If you need to capture stderr during the build process, use make 2>error_log.txt instead.
- Using CF-Lite in your own programs:
- If you're using GCC
- You will need to define the preprocessor directive __WIN32__ in your build.
- Works just like using a DLL in other GCC apps.
- Make sure you use the -mno-cygwin flag to prevent gcc from linking with the cygwin dll and C runtime. Link with -lmsvcrt instead.
- Visual Studio 2005
- You will need to define the preprocessor directive __WIN32__ in your build.
- In release target builds, you need to disable Visual Studio's library loading trimming. To do this, open your project properties, expand Configuration Properties, expand Linker, select Optimizations, then set the field labelled references to 'Keep Unreferenced Data (/OPT:NOREF)'. If you don't do this, you can have crashes at fairly innocent seeming functions because Visual Studio didn't load the object code for that particular module.
- If you're using GCC
- Download CFTest source files. This is the test harness sample project.
- You can ignore the XCode project
- create a new project in your windows dev environment and add the two .cpp files.
- the "console.txt" is the example output that it should look like in your console
- you may need to tweak the relative path for "test.xml" to load properly.
Please document any necessary changes to the source code.