|
ACIS overloads the
C++new operator to allocate space on the portion of the heap controlled by
ACIS. This is used in conjunction with the other constructors. Each class derived from
ENTITY defines its own
new and
delete operators that the
ACIS free list manager. (These operators are supplied by the
ENTITY_FUNCTIONS and
UTILITY_DEF macros.)
|
|
|
When working with Microsoft Developer Studio and/or MFC, the beginning of the file may have been enhanced by Microsoft during a
_DEBUG compile. Sometimes you will see:
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
// ... other code...
|
|
#endif
|
|
|
This interferes with the
ACIS overloading of
new for the entities. So you have two options. Either remove the offending define or move the code that creates your
ENTITY objects to another file.
|
|
|
In fact it is an issue when trying to instantiate any object derived from an
ACIS entity in MFC.
ACIS overrides
new and
delete for all entity objects and thus one cannot use the standard
new operator. Using the
new operator for
ENTITY derivations needs to have
API_BEGIN/API_END around the
ENTITY creation code, so it is best to do the allocation in an API function.
|
|
|
outcome api_make_attrib(ENTITY*& ent,
|
|
ATTRIB_GEN_INTEGER*& attrib,
|
|
char*& name, int& value)
|
|
{
|
|
API_BEGIN
|
|
#undef new
|
|
attrib = new ATTRIB_GEN_INTEGER(ent,
|
|
|
name, value);
|
|
#define new DEBUG_NEW
|
|
API_END
|
|
}
|