DX does use a namespace convention - at least, sort of.  Procedures are
prefixed DX if they are external API entry points, _dxf if they are not API
entry points but still visible to the linker.  Variables are _dxd if they
are visible to the linker.  However, there are indeed a lot of typedefs
etc. in the header files that are not conventionally named.   If your code
doesn't #include dx/dx.h along with the other library's headers, then there
shouldn't be a problm linking them together.  If both headers are included,
then there is a problem.  It bites us when including X headers with DX
headers.  Our inelegant solution is to wrap the #include <dx/dx.h> with
#ifdef and #undef:

#define Object DXObject
#define Array DXArray
#define Field DXField
#include <dx/dx.h>
#undef Object
#undef Array
#undef Field


and then when you want to refer to a DX Field in the code, use DXField.

Greg

Niklas Wikstrom <[EMAIL PROTECTED]>@opendx.watson.ibm.com on
11/16/2000 08:12:29 AM

Please respond to [email protected]

Sent by:  [EMAIL PROTECTED]


To:   [email protected]
cc:
Subject:  [opendx-users] Namespace?




Hi, this is a bit beyond my capabilituies as a programmer but:
 I am trying to write a reader module (ie a module with which to import
data from the code I use to generate data (a library called "FOAM")),
which seems fairly easy. My first problem is that as I want to link
dx-libraries to the code I use there is a Class name ambiguity: Both
libraries uses classes Field, Array etc. I guess I have to distinguish
them by using 'namespace'. FOAM uses the namespace 'foam' but is there a
namespace defined in DX? Of course i am open to other sugestions.
 (Why on earth do people not use prefixes??)

Niklas



Reply via email to