I am trying to write a console based application to access a Canon camera on Mac OS X 10.7.5. I am using XCode version 4.6 for the same. This is the program I am trying to write
#import <Foundation/Foundation.h>
#include "EDSDK.h"
#include "EDSDKErrors.h"
#include "EDSDKTypes.h"
int main()
{
@autoreleasepool {
EdsError error = EDS_ERR_OK;
EdsCameraListRef cameraList = NULL;
EdsUInt32 count = 0;
EdsDeviceInfo deviceInfo;
bool isSDKLoaded;
// Initialization of SDK
error = EdsInitializeSDK();
//Acquisition of camera list
if(error == EDS_ERR_OK)
{
isSDKLoaded = YES;
error = EdsGetCameraList(&cameraList);
}
if(cameraList != NULL) {
EdsRelease(cameraList);
cameraList = NULL;
}
}
return 0;
}
It compiles successfully but when I run the program it crashes when the EdsGetCameraList function returns. The error shown is 'dyld misaligned_stack_error'. I understand that this has something to do with the fact that MacOS X wants the stack to be 16-byte aligned. The SDK I am using is only available for 32 bit architectures and hence, I have set the architecture accordingly. I tried setting the "Other C flags" under Build Settings in XCode to include the flag "-falign-stack=assume-16-byte" as well.
The sample that came along with the Canon EDSDK works fine. The version of the SDK being used is the one developed by Canon in 2006-2007 updated on 06-03-16. I have no other version information on it.
Following is the dump from the logs : http://pastebin.com/vfDWeZnr
What could I be possibly doing wrong?
I am really new to Objective-C and hence, the mix up of C and Objective-C code.
Thanks!