> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:fpc-pascal- > [EMAIL PROTECTED] On Behalf Of Jonas Maebe > Sent: 29. september 2008 10:46 > To: FPC-Pascal users discussions > Subject: Re: [fpc-pascal] Carbon: i386 vs PPC API's > > On 29 Sep 2008, at 09:27, EarMaster - Bent Olsen wrote: > > > Is there any precautions one should make when sharing FPC codes > > between i386 > > and PowerPC? > > > > I've few calls to AudioToolbox API's which works fine under i386, but > > crashes in PPC - the exact API call is AudioConverterNew, and the > > records > > passed to the API looks good, and is also returned by AudioToolbox > > itself. > > > > It doesn't return an error code - just crashes with EXC_ARITHMETIC > > error in > > a procedure called SincKernel::CalculateFilterCoefficients. > > First of all: when starting a new thread, please write a new message > to the mailing list rather than replying to an existing one and > changing the subject. Such replies mess up automatic threading both in > the web archive and in various mail clients.
Noted! Sorry, I wasn't aware of this. > That said, the crash you get is caused by a floating point arithmetic > error (one of many) in Apple's system frameworks (which also exist in > several OpenGL implementations for Windows, in GTK2 etc). These do not > cause any problems in most C programs, because in C programs by > default all floating point exceptions are masked (and hence no one > ever notices such errors). > > You can mask them in FPC as well by adding the "math" unit to your > uses clause and performing the following call at the start of your > program: Thanks! I did this, and it works like a charm ;-) > SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, > exOverflow, exUnderflow, exPrecision]) > > Note that this will mask all floating point exceptions everywhere, > i.e., also in your Pascal code. The only alternative is to save, > change and restore the floating point exception mask around every call > to a system routine directly or indirectly related to audio or > graphics. > > Jonas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal