Re: [eclipse-clp-users] C Interface Functions does not support int64

From: Kish Shen <kisshen_at_cisco.com>
Date: Sun, 25 Oct 2009 01:18:39 +0100
Daniel Saur wrote:
> i use the C Interface Functions in Eclipse (Embedding and Interfacing Manual, 
> Release 6.0). While i construct a term, i use the function ec_long. But this 
> function is only for int32, but not for int64. It is possible to build a term 
> as int64?

int64 and int32 are *not* standard C types. Standard C integer types do 
not specify the length of the type, allowing them to be implemented 
differently on different platforms. int64 and int32 runs counter to 
this, and I believe they are Microsoft "extensions" (at least 
originally). So I assume the intention of your question is, can you pass 
a 64 bit integer to ECLiPSe,  specifically on Windows?

This is not a question with a simple answer -- because it depends on 
what platform you are using. In ECLiPSe, integers are stored in a word 
sized integer, so unless you are running on a (supported) 64 bit 
platform, you cannot pass a 64 bit integer to ECLiPSe from the standard 
C/C++ interface. Within ECLiPSe, using GNU's GMP library, integers can 
be of unlimited size, but this is not exposed via the standard interface.

Secondly, Windows complicates the issue, because it defines the standard 
  C integer types differently from every one else. ec_long maps to C 
type long, and the intention was that this should be the machine word 
length (i.e. 32 bit on 32 bit machines, 64 bit on 64 bit machines), 
which is true of most C, except for Windows (MSVC), where long is 32 
bit, no matter if you are using 64 or 32 bit Windows. So you cannot have 
64 bit integers using standard C/C++ types on MSVC.

ECLiPSe has only been ported to Win64 recently, and it was done on the 
main development branch, i.e. version 6.1, and not for the released 6.0.
So potentially, you can only pass 64 bit integers to ECLiPSe on Win64, 
with ECLiPSe 6.1. However, we did not change the standard C/C++ 
interface, because we wanted the interface to map to standard C integer 
types, and long is the longest C integer type that can definitely fit 
into a machine word in any modern machine.

Cheers,

Kish

-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Sun Oct 25 2009 - 00:23:07 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET