11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7.3 System Integrity • 337by another algebraic structure is automatically destroyed and its memoryreclaimed. Algebraics are protected from garbage collection if they areused somewhere (that is, the value of a global name or part of an array’sdata). The normal state of an algebraic is to have garbage collectionenabled on it.7.3 System IntegrityThe Maple kernel has no control over the quality or reliability of externalfunctions. If an external function performs an illegal operation, such asaccessing memory outside of its address space, that operation can resultin a segmentation fault or system error. The external routine crashes,causing Maple to crash too.If an external routine accesses memory outside of its address space butinside the Maple address space, the external routine will likely not crash,but Maple will become corrupted, resulting in inexplicable behavior or acrash later in the Maple session. Similarly, an external routine that dealsdirectly with Maple data structures can corrupt Maple by misusing thedata structure manipulation facilities.Therefore, use external calling at your own risk. Whether an externalroutine is one that you have written, or is one supplied by a third partyto which you have declared an interface (via define_external), Maplemust rely on the integrity of the external routine when it is called.7.4 ConclusionThis chapter outlined how the CodeGeneration package provides utilitiesfor translating Maple code into other programming languages. Additionally,this chapter covered how compiled code can be integrated into Mapleand how that compiled code extends the Maple kernel.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!