[Liblas-devel] .net/mono bindings in c#

Martin Rodriguez mrodriguez at stereocarto.com
Fri Aug 8 03:04:50 EDT 2008


Hi:


>Is it enough solution to add tests for MINGW and CYGWIN to these #ifdef's ?

I think the most important is the MACRO in the CAPI. This is easy to solve.

In respect to type in glib they solve all types like this:

typedef signed char gint8;
typedef unsigned char guint8;
typedef signed short gint16;
typedef unsigned short guint16;
typedef signed int gint32;
typedef unsigned int guint32;

#ifndef _MSC_VER
G_GNUC_EXTENSION typedef signed long long gint64;
G_GNUC_EXTENSION typedef unsigned long long guint64;
#else /* _MSC_VER */
typedef signed __int64 gint64;
typedef unsigned __int64 guint64;
#endif /* _MSC_VER */




There are other interesting macros to work with doubles and floats:
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
union _GFloatIEEE754
{
  gfloat v_float;
  struct {
    guint mantissa : 23;
    guint biased_exponent : 8;
    guint sign : 1;
  } mpn;
};
union _GDoubleIEEE754
{
  gdouble v_double;
  struct {
    guint mantissa_low : 32;
    guint mantissa_high : 20;
    guint biased_exponent : 11;
    guint sign : 1;
  } mpn;
};
#elif G_BYTE_ORDER == G_BIG_ENDIAN
union _GFloatIEEE754
{
  gfloat v_float;
  struct {
    guint sign : 1;
    guint biased_exponent : 8;
    guint mantissa : 23;
  } mpn;
};
union _GDoubleIEEE754
{
  gdouble v_double;
  struct {
    guint sign : 1;
    guint biased_exponent : 11;
    guint mantissa_high : 20;
    guint mantissa_low : 32;
  } mpn;
};
#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
#error unknown ENDIAN type
#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */



> Yes, I agree this is a good practice but the idea behind integer types 
> in libLAS was to make them compatible with integer types defined in ANSI 
> C99. That's why we use Boost-like defs.
> IOW, those who use compilers that support ANSI C99 (like GCC) do not 
> need libLAS definitions from cstdint.hpp, and it's #ifdef'ed out actually.
> But if someone uses compiler without C99 support, like Microsoft Visual 
> C++, then types defined in liblas/cstdint.hpp are used.

Ok. I see :
http://www.boost.org/doc/libs/1_35_0/libs/integer/cstdint.htm

It seems like K-3D people have a boost version for MINGW. I see the cstdint
file there and it's the same like the standard boost file and therefore I am
sure works well in MINGW.
http://www.k-3d.org/wiki/Windows_Build/MinGW
I compiled liblas in mingw with g++ and works fine, but for me it was
difficult understand cstdint file and I was not sure what types I finally
had in mingw. I only had real problems with the CAPI and the MACRO, but if
add mingw all fine.



Regards.





More information about the Liblas-devel mailing list