<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> <!-- Created by texi2html 1.76 --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> Olaf Bachmann <obachman@mathematik.uni-kl.de> and many others. Maintained by: Many creative people <dev@texi2html.cvshome.org> Send bugs and suggestions to <users@texi2html.cvshome.org> --> <head> <title>Crystal Space 1.2.1: C.2.16 64-Bit Portability Changes</title> <meta name="description" content="Crystal Space 1.2.1: C.2.16 64-Bit Portability Changes"> <meta name="keywords" content="Crystal Space 1.2.1: C.2.16 64-Bit Portability Changes"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="texi2html 1.76"> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} pre.display {font-family: serif} pre.format {font-family: serif} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: serif; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: serif; font-size: smaller} pre.smalllisp {font-size: smaller} span.sansserif {font-family:sans-serif; font-weight:normal;} ul.toc {list-style: none} --> </style> </head> <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> <a name="Api1_005f0-64_002dBit-Portability-Changes"></a> <a name="0"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="Api1_005f0-Reference-Count-Automation.html#0" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="Api1_005f0-aws-Changes.html#0" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="Release-Notes.html#0" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="Release-Notes-1_005f0.html#0" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="Licenses.html#0" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="index.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="cs_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="cs_Index.html#0" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="cs_abt.html#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <hr size="1"> <h3 class="subsection"> C.2.16 64-Bit Portability Changes </h3> <p>Some changes have been made to the Crystal Space <small>API</small> in order to better support 64-bit hardware, which is now becoming common. Additional changes to improve 64-bit support have also been made internally, but the internal changes essentially are transparent to external clients. </p> <p>The most significant change to the <small>API</small> involves methods and classes dealing with data opaquely. Historically, opaque data has been handled using <samp>‘void*’</samp>, and programmers would cast numbers, booleans, and pointers to <samp>‘void*’</samp> when it was necessary to deal with the data in an opaque fashion. This technique, however, is not portable to 64-bit platforms. For this reason, the new standard type <samp>‘intptr_t’</samp> was introduced. This type is guaranteed to be large enough to store any integral numeric or pointer value regardless of the machine's word size. </p> <p>Crystal Space now uniformly uses <samp>‘intptr_t’</samp>, rather than <samp>‘void*’</samp>, when dealing with opaque data. Upgrading your code to reflect this change is usually quite simple. Where your code presently declares a variable or casts a value to <samp>‘void*’</samp>, change it to <samp>‘intptr_t’</samp>. Likewise, <samp>‘void**’</samp> becomes <samp>‘intptr_t*’</samp>. For example: </p> <table><tr><td> </td><td><pre class="example">iGraphics2D canvas = ...; iEventOutlet* outlet = ...; outlet->Broadcast(cscmdCanvasExposed, (void*)canvas); </pre></td></tr></table> <p>Becomes: </p> <table><tr><td> </td><td><pre class="example">outlet->Broadcast(cscmdCanvasExposed, (intptr_t)canvas); </pre></td></tr></table> <p>The event system is impacted by this change. Specifically, the following methods and data members now deal with <samp>‘intptr_t’</samp> rather than <samp>‘void*’</samp> for the opaque “info” member of <code>csevCommand</code>-type events. </p> <ul> <li> <code>csEvent::csEvent()</code> </li><li> <code>csEventCommandData::Info</code> </li><li> <code>iEventOutlet::Broadcast()</code> </li><li> <code>iEventOutlet::ImmediateBroadcast()</code> </li></ul> <p>The <small>AWS</small> plugin (Alternate Windowing System) and its interfaces have been been updated for 64-bit platform conformance. Specifically, the following methods now deal with <samp>‘intptr_t’</samp> rather than <samp>‘void*’</samp> for all of <small>AWS</small>'s opaque data needs. </p> <ul> <li> <code>iAwsComponent::GetProperty()</code> </li><li> <code>iAwsComponent::SetProperty()</code> </li><li> <code>iAwsParmList::AddOpaque()</code> </li><li> <code>iAwsParmList::GetOpaque()</code> </li><li> <code>iAwsSink::RegisterTrigger()</code> </li><li> <code>iAwsSinkManager::CreateSink()</code> </li></ul> <p><small>AWS</small> callback functions (<em>triggers</em>) are likewise impacted. You need to change the declaration of your triggers to use <samp>‘intptr_t’</samp> rather than <samp>‘void*’</samp>. For example: </p> <table><tr><td> </td><td><pre class="example">void MyTrigger(void* sink, iAwsSource* source); </pre></td></tr></table> <p>Becomes: </p> <table><tr><td> </td><td><pre class="example">void MyTrigger(intptr_t sink, iAwsSource* source); </pre></td></tr></table> <p>Since converting client <small>AWS</small> code to the new <small>API</small> can be rather onerous on account of the amount of repetitious manual labor involved, the old <samp>‘void*’</samp> <small>API</small> is still present in <small>AWS</small>, though heavily deprecated. In the interests of 64-bit portability, the old <small>API</small> will be removed at some point in the future. You are encouraged, therefore, to convert your code to the new <small>API</small>. As an aid to clients in upgrading their code to the new <small>API</small>, one of two control macros can be defined which will help to isolate code which needs to be updated. Defining <samp>‘AWS_OBSOLETE_VOIDP’</samp> (via <samp>‘#define’</samp> before including <tt>‘iaws/aws.h’</tt>) removes from the <small>API</small> all methods dealing with <samp>‘void*’</samp>, thus invocations of any such methods will result in compilation errors. Alternately, defining <samp>‘AWS_DEPRECATE_VOIDP’</samp>, will cause invocations of methods dealing with <samp>‘void*’</samp> to generate compilation warnings, assuming that the compiler supports such deprecation warnings. (Presently, only modern version of the <small>GNU</small> compiler are so configured.) </p> <hr size="1"> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="Api1_005f0-Reference-Count-Automation.html#0" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="Api1_005f0-aws-Changes.html#0" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="Release-Notes.html#0" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="Release-Notes-1_005f0.html#0" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="Licenses.html#0" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="index.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="cs_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="cs_Index.html#0" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="cs_abt.html#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <p> <font size="-1"> This document was generated using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>. </font> <br> </p> </body> </html>