On 05/02/2011, at 5:09 AM, Bisht, Pradeep wrote:

> Hello, has any one been successful in compiling and using Judy on 64-bit 
> windows.


Yes.

> First I think there is a bug in Judy.h -
> 
> typedef unsigned long    Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
> 
> should have been
> 
> #ifdef JU_WIN
> #ifdef JU_64BIT
> typedef uint64_t Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
> #else
> typedef uint32_t Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
> #endif
> #else  // JU_WIN
> typedef unsigned long    Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
> #endif
> 
> Am I correct?


Yes. This is the top of Judy.h that I use:
/////////////////////////////////////
#ifndef JUDY_EXTERN
#if defined(_WIN32) && !defined(FLX_STATIC_LINK)
#ifdef BUILD_JUDY
#define JUDY_EXTERN __declspec(dllexport)
#else
#define JUDY_EXTERN __declspec(dllimport)
#endif
#else
#define JUDY_EXTERN
#endif
#endif

/* here JU_WIN <=> MSVC CL build */
#ifdef _MSC_VER
#define JU_WIN
#endif


#ifndef _JUDY_INCLUDED
#define _JUDY_INCLUDED
// _________________
//

// @(#) $Revision: 4.52 $ $Source: /judy/src/Judy.h $
//
// HEADER FILE FOR EXPORTED FEATURES IN JUDY LIBRARY, libJudy.*
//
// See the manual entries for details.
//
// Note:  This header file uses old-style comments on #-directive lines and
// avoids "()" on macro names in comments for compatibility with older cc -Aa
// and some tools on some platforms.


// PLATFORM-SPECIFIC

#ifdef JU_WIN /* =============================================== */

typedef __int8           int8_t;
typedef __int16          int16_t;
typedef __int32          int32_t;
typedef __int64          int64_t;

typedef unsigned __int8  uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;

#else /* ================ ! JU_WIN ============================= */

// ISO C99: 7.8 Format conversion of integer types <inttypes.h>
#include <inttypes.h>  /* if this FAILS, try #include <stdint.h> */

// ISO C99: 7.18 Integer types uint*_t
//#include <stdint.h>

#endif /* ================ ! JU_WIN ============================= */

// ISO C99 Standard: 7.20 General utilities
#include <stdlib.h>

// ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types
#include <limits.h>

#ifdef __cplusplus      /* support use by C++ code */
extern "C" {
#endif


// ****************************************************************************
// DECLARE SOME BASE TYPES IN CASE THEY ARE MISSING:
//
// These base types include "const" where appropriate, but only where of
// interest to the caller.  For example, a caller cares that a variable passed
// by reference will not be modified, such as, "const void * Pindex", but not
// that the called function internally does not modify the pointer itself, such
// as, "void * const Pindex".
//
// Note that its OK to pass a Pvoid_t to a Pcvoid_t; the latter is the same,
// only constant.  Callers need to do this so they can also pass & Pvoid_t to
// PPvoid_t (non-constant).

#ifndef _PCVOID_T
#define _PCVOID_T
typedef const void * Pcvoid_t;
#endif

#ifndef _PVOID_T
#define _PVOID_T
typedef void *   Pvoid_t;
typedef void ** PPvoid_t;
#endif

#ifndef _WORD_T
#define _WORD_T
#if defined(_WIN64)
typedef unsigned long long   Word_t, * PWord_t;  // expect 32-bit or 64-bit 
words.
#else
typedef unsigned long    Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
#endif
#endif

#ifndef NULL
#define NULL 0
#endif

//////////////////////////////////////////////////////



> Before making this change Judy1/LTaleGen.exe was failing in 
> generating the tables and printing error ""BUG, in %sPopToWords, sizes not 
> big 
> enough for object\n".\

I do not use that generator.
We used it ONCE to make the 32 bit files and ONCE to make the 64 bit files
then committed the result.

> 
> Now that I'm able to compile, it is crashing. my sample code is:
> 
> void BuildJA ()
> {
>     Pvoid_t Parray = (Pvoid_t)NULL; // empty JudyL array
>     Word_t lba, *Pvalue; // value for one index
>     unsigned int i;
>     
>     for (i = 0; i < 1000; i++) {
>         lba = i;
>         // it crashes here for i = 1 
>        JLI (Pvalue, Parray, lba);
>         *Pvalue = 1;
>     }
>  }

Grrrr .. Ignore Doug's advice here. Use the functions, don't use macros.
The macros confuse things by silently taking addresses of some arguments,
thereby confusing when you need a value and when you need an lvalue.
C++ references have the same problem.

Using the C functions it is always clear although it takes some thought.

However your program should work as far as I can see.


--
john skaller
[email protected]





------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to