Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enabling altivec in XCode



Hi Michael,

Your app is crashing because you haven't defined __VEC__, and hence, the compiler didn't create the HasAltiVec() function. The purpose of __VEC__ is to decide whether various vector operations should be performed with java mode turned off (for G4 processors). Unless you're sure you want that, I recommend just dumping any code you copy from the vDSPExample code that is wrapped in the check for __VEC__.

On a side note, unless you're specifically writing altivec code, the accelerate framework chooses the vector or scalar implementation for you. You don't even need to enable altivec code generation.

-- John


This may be a bit off-topic, but I'd imagine there are vDSP users here..

in the /Developer/Examples/Accelerate/vDSP/vDSPExamples/main.c

there is

#if defined(__VEC__)

...stuff

#endif

well when I compile it, it compiles and runs fine without error. However when I created my own project, main.c :

#if defined(__VEC__)
Boolean HasAltiVec(void) {
int mib[2], gHasAltivec;
size_t len;

mib[0] = CTL_HW;
mib[1] = HW_VECTORUNIT;
len = sizeof(gHasAltivec);
sysctl(mib, 2, &gHasAltivec, &len, NULL, 0);
return (gHasAltivec != 0);
}
#endif

int main (int argc, const char * argv[]) {
// insert code here...

Boolean hasVectorUnit = HasAltiVec();

printf("Hello, World!\n %d", hasVectorUnit);
return 0;
}

I get an error

[Session started at 2005-02-01 21:12:12 -0500.]
ZeroLink: unknown symbol '_HasAltiVec'

Executable “Test_vdsp” has exited due to signal 6 (SIGABRT).

so it seems it can't find Boolean HasAltiVec(void) so I checked the XCode settings, and I noticed the "Enable Altivec Extensions" checkbox. Still no difference. I noticed that the vDSPExamples project doesn't even have this setting on and it still seems to work. How do I enable Altivec?
regards,
Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/coreaudio-api/email@hidden

This email sent to email@hidden
References: 
 >enabling altivec in XCode (From: Michael Hanna <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.