MonoTouch リンク プロジェクトを介してリンクしたライブラリを使用すると、ビルド出力から次のエラーが発生します。
アーキテクチャー armv7 の未定義シンボル:
ヘッダー ファイルは次のとおりです (スペースの eum を省略します)。
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <AudioUnit/AudioUnit.h>
#import <ExternalAccessory/ExternalAccessory.h>
@interface MTSCRA : NSObject <NSStreamDelegate>
{
@private
NSString *cardIIN;
NSString *cardData;
NSString *cardLast4;
NSString *cardName;
NSString *cardExpDate;
NSString *cardServiceCode;
NSString *cardStatus;
NSString *responseData;
NSString *maskedTracks;
NSString *stdTrack1;
NSString *stdTrack2;
NSString *stdTrack3;
NSString *encryptedTrack1;
NSString *encryptedTrack2;
NSString *encryptedTrack3;
NSString *encryptionStatus;
NSString *maskedTrack1;
NSString *maskedTrack2;
NSString *maskedTrack3;
NSString *trackDecodeStatus;
NSString *encryptedMagneprint;
NSString *magneprintStatus;
NSString *deviceSerialNumber;
NSString *deviceSerialNumberMagTek;
NSString *encrypedSessionID;
NSString *deviceKSN;
NSString *deviceFirmware;
NSString *deviceName;
NSString *deviceCaps;
NSString *deviceStatus;
NSString *tlvVersion;
NSString *devicePartNumber;
NSString *capMSR;
NSString *capTracks;
NSString *capMagStripeEncryption;
NSString *maskedPAN;
NSString *additionalInfoTrack1;
NSString *additionalInfoTrack2;
NSString *responseType;
NSString *batteryLevel;
NSString *swipeCount;
//NSArray *aryCardData;
//NSArray *aryMaskedTracks;
AudioUnit rioUnit;
AURenderCallbackStruct inputProc;
AudioStreamBasicDescription thruFormat;
AudioBufferList bufferlist;
AudioBuffer buf;
AudioBuffer buf1;
BOOL isDeviceConnected;
long eventMask;
long devCapabilities;
Byte *commandBits;
int commandBitsIndex;
EAAccessory * _accessory;
EASession * _session;
EAAccessoryManager *eaAccessory;
NSMutableString *dataFromiDynamo;
NSMutableString *deviceProtocolString;
NSMutableString *configParams;
enum MTSCRADeviceType devType;
@public
}
//Initialize device
-(BOOL) openDevice;
//Close device
-(BOOL) closeDevice;
//Retrieves if the device is connected
- (BOOL) isDeviceConnected;
//Retrieve Masked Track1 if any
- (NSString *) getTrack1Masked;
//Retrieve Masked Track2 if any
- (NSString *) getTrack2Masked;
//Retrieve Masked Track3 if any
- (NSString *) getTrack3Masked;
//Retrieves existing stored Masked data, only supported for iDynamo, it will return a empty string in audio reader
- (NSString *) getMaskedTracks;
//Retrieve Encrypted Track1 if any
- (NSString *) getTrack1;
//Retrieve Encrypted Track2 if any
- (NSString *) getTrack2;
//Retrieve Encrypted Track3 if any
- (NSString *) getTrack3;
//Retrieve Encrypted MagnePrint, only supported for iDynamo, it will return a empty string in audio reader
- (NSString *) getMagnePrint;
//Retrieve MagnePrint Status, only supported for iDynamo, it will return a empty string in audio reader
- (NSString *) getMagnePrintStatus;
//Retrieve Device Serial Number
- (NSString *) getDeviceSerial;
//Retrieve Device Serial Number created by MagTek
- (NSString *) getMagTekDeviceSerial;
//Retrieve Firmware Vsersion Number
- (NSString *) getFirmware;
//Retrieve Device Name
- (NSString *) getDeviceName;
//Retrieve Device Capabilities
- (NSString *) getDeviceCaps;
//Retrieve Device Status
- (NSString *) getDeviceStatus;
//Retrieve TLV Version
- (NSString *) getTLVVersion;
//Retrieve Device Part Number
- (NSString *) getDevicePartNumber;
//Retrieve Key Serial Number
- (NSString *) getKSN;
//Retrieve individual tag value, only supported in audio reader
- (NSString *) getTagValue: (UInt32)tag;
//Retrieve MSR Capability
- (NSString *) getCapMSR;
//Retrieve Tracks Capability
- (NSString *) getCapTracks;
//Retrieve MagStripe Encryption Capability
- (NSString *) getCapMagStripeEncryption;
//Send Commands To The Device
- (void) sendCommandToDevice:(NSString *)pData;
//Sets the protocol String for iDynamo
- (void) setDeviceProtocolString:(NSString *)pData;
//Sets the config params for SDK
- (void) setConfigurationParams:(NSString *)pData;
//Setup the events to listen for
- (void) listenForEvents:(UInt32)event;
//Retrieves the Device Type
- (int) getDeviceType;
//Retrieves the Length of teh PAN
- (int) getCardPANLength;
//Retrieve Session ID, only supported for iDynamo, it will return a empty string in audio reader
- (NSString *) getSessionID;
//Retrieved the whole Response from the reader
- (NSString *) getResponseData;
//Retrieves the Name in the Card
- (NSString *) getCardName;
//Retrieves the IIN in the Card
- (NSString *) getCardIIN;
//Retrieves the Last 4 of the PAN
- (NSString *) getCardLast4;
//Retrieves the Expiration Date
- (NSString *) getCardExpDate;
//Retrieves the Service Code
- (NSString *) getCardServiceCode;
//Retrieves the Card Status
- (NSString *) getCardStatus;
//Retrieves the Track Decode Status
- (NSString *) getTrackDecodeStatus;
//Retrieve Response Type
- (NSString *) getResponseType;
//Sets the type of device to Open
-(void) setDeviceType: (UInt32)deviceType;
//Retrieves device opened status
- (BOOL) isDeviceOpened;
// Clears all the buffer that is stored during card swipe or command response
- (void) clearBuffers;
//Retrieves the battery Level
- (long) getBatteryLevel;
//Retrieves the swipe count
- (long) getSwipeCount;
//Gets the current version of the SDK.
- (NSString *) getSDKVersion;
//Retrieves the Operation Status
- (NSString *) getOperationStatus;
//Config Functions
- (NSString *) getEncryptionStatus;
//Config Functions
@end
私のApiDefinitionは次のようになります
using System;
using System.Drawing;
using MonoTouch.ObjCRuntime;
using MonoTouch.Foundation;
using MonoTouch.AudioToolbox;
using MonoTouch.ExternalAccessory;
using MonoTouch.UIKit;
namespace CreditCardReaderIDynamoDLL
{
[BaseType(typeof(NSObject))]
[Model]
interface NSStreamDelegate
{
}
[BaseType(typeof(NSObject),Delegates=new string[]{"WeakDelegate"},Events = new Type[] {(typeof(NSStreamDelegate))})]
interface MISCRA{
[Export("delegate"), NullAllowed]
NSObject WeakDelegate{get; set;}
[Wrap("WeakDelegate")][New]
NSStreamDelegate Delegate{get; set;}
[ExportAttribute("cardIIN")]
NSString CardIIN{[Bind("cardIIN")]get; set;}
[ExportAttribute("cardData")]
NSString CardData{[Bind("cardData")]get; set;}
[ExportAttribute("cardLast4")]
NSString CardLast4{[Bind("cardLast4")]get; set;}
[ExportAttribute("cardName")]
NSString CardName{[Bind("cardName")]get; set;}
[ExportAttribute("cardExpDate")]
NSString cardExpDate{[Bind("cardExpDate")]get; set;}
[ExportAttribute("cardServiceCode")]
NSString CardServiceCode{[Bind("cardServiceCode")]get; set;}
[ExportAttribute("cardStatus")]
NSString CardStatus{[Bind("cardStatus")]get; set;}
[ExportAttribute("responseData")]
NSString ResponseData{[Bind("responseData")]get; set;}
[ExportAttribute("maskedTracks")]
NSString MaskedTracks{[Bind("maskedTracks")]get; set;}
[ExportAttribute("stdTrack1")]
NSString StdTrack1{[Bind("stdTrack1")]get; set;}
[ExportAttribute("stdTrack2")]
NSString StdTrack2{[Bind("stdTrack2")]get; set;}
[ExportAttribute("stdTrack3")]
NSString StdTrack3{[Bind("stdTrack3")]get; set;}
[ExportAttribute("encryptedTrack1")]
NSString EncryptedTrack1{[Bind("encryptedTrack1")]get; set;}
[ExportAttribute("encryptedTrack2")]
NSString EncryptedTrack2{[Bind("encryptedTrack2")]get; set;}
[ExportAttribute("encryptedTrack3")]
NSString EncryptedTrack3{[Bind("encryptedTrack3")]get; set;}
[ExportAttribute("encryptionStatus")]
NSString EncryptionStatus{[Bind("encryptionStatus")]get; set;}
[ExportAttribute("maskedTrack1")]
NSString MaskedTrack1{[Bind("maskedTrack1")]get; set;}
[ExportAttribute("maskedTrack2")]
NSString MaskedTrack2{[Bind("maskedTrack2")]get; set;}
[ExportAttribute("maskedTrack3")]
NSString MaskedTrack3{[Bind("maskedTrack3")]get; set;}
[ExportAttribute("trackDecodeStatus")]
NSString TrackDecodeStatus{[Bind("trackDecodeStatus")]get; set;}
[ExportAttribute("encryptedMagneprint")]
NSString EncryptedMagneprint{[Bind("encryptedMagneprint")]get; set;}
[ExportAttribute("magneprintStatus")]
NSString MagneprintStatus{[Bind("magneprintStatus")]get; set;}
[ExportAttribute("deviceSerialNumber")]
NSString DeviceSerialNumber{[Bind("deviceSerialNumber")]get; set;}
[ExportAttribute("deviceSerialNumberMagTek")]
NSString DeviceSerialNumberMagTek{[Bind("deviceSerialNumberMagTek")]get; set;}
[ExportAttribute("encrypedSessionID")]
NSString EncrypedSessionID{[Bind("encrypedSessionID")]get; set;}
[ExportAttribute("deviceKSN")]
NSString DeviceKSN{[Bind("deviceKSN")]get; set;}
[ExportAttribute("deviceFirmware")]
NSString DeviceFirmware{[Bind("deviceFirmware")]get; set;}
[ExportAttribute("deviceName")]
NSString deviceName{[Bind("deviceName")]get; set;}
[ExportAttribute("deviceCaps")]
NSString DeviceCaps{[Bind("deviceCaps")]get; set;}
[ExportAttribute("deviceStatus")]
NSString DeviceStatus{[Bind("deviceStatus")]get; set;}
[ExportAttribute("tlvVersion")]
NSString TlvVersion{[Bind("tlvVersion")]get; set;}
[ExportAttribute("devicePartNumber")]
NSString DevicePartNumber{[Bind("devicePartNumber")]get; set;}
[ExportAttribute("capMSR")]
NSString CapMSR{[Bind("capMSR")]get; set;}
[ExportAttribute("capTracks")]
NSString CapTracks{[Bind("capTracks")]get; set;}
[ExportAttribute("capMagStripeEncryption")]
NSString CapMagStripeEncryption{[Bind("capMagStripeEncryption")]get; set;}
[ExportAttribute("MaskedPAN")]
NSString MaskedPAN{[Bind("MaskedPAN")]get; set;}
[ExportAttribute("additionalInfoTrack1")]
NSString AdditionalInfoTrack1{[Bind("additionalInfoTrack1")]get; set;}
[ExportAttribute("additionalInfoTrack2")]
NSString AdditionalInfoTrack2{[Bind("additionalInfoTrack2")]get; set;}
[ExportAttribute("responseType")]
NSString ResponseType{[Bind("responseType")]get; set;}
[ExportAttribute("batteryLevel")]
NSString BatteryLevel{[Bind("batteryLevel")]get; set;}
[ExportAttribute("swipeCount")]
NSString swipeCount{[Bind("swipeCount")]get; set;}
/* [ExportAttribute("rioUnit")]
AudioUnit RioUnit{[Bind("rioUnit")]get; set;}
[ExportAttribute("inputProc")]
AURenderCallbackStruct InputProc{ [Bind("inputProc")]get; set; }*/
[ExportAttribute("thruFormat")]
AudioStreamBasicDescription ThruFormat{[Bind("thruFormat")]get; set;}
[ExportAttribute("bufferlist")]
AudioBuffer Bufferlist{[Bind("bufferlist")]get; set;}
[ExportAttribute("buf")]
AudioBuffer Buf{[Bind("buf")]get; set;}
[ExportAttribute("buf1")]
AudioBuffer Buf1{[Bind("buf1")]get; set;}
[ExportAttribute("isDeviceConnected")]
bool IsDeviceConnected{ [Bind("isDeviceConnected")]get; set; }
[ExportAttribute("eventMask")]
long EventMask{[Bind("eventMask")]get; set;}
[ExportAttribute("devCapabilities")]
long devCapabilities{ [Bind("devCapabilities")]get; set; }
[ExportAttribute("commandBits")]
Byte CommandBits{ [Bind("commandBits")]get; set; }
[ExportAttribute("commandBitsIndex")]
int CommandBitsIndex{ [Bind("commandBitsIndex")]get; set; }
[ExportAttribute("_accessory")]
EAAccessory _Accessory{ [Bind("_accessory")]get; set; }
[ExportAttribute("_session")]
EASession _Session{ [Bind("_session")]get; set; }
[ExportAttribute("eaAccessory")]
EAAccessoryManager EaAccessory{ [Bind("eaAccessory")]get; set; }
[ExportAttribute("dataFromiDynamo")]
NSMutableAttributedString DataFromiDynamo{ [Bind("dataFromiDynamo")]get; set; }
[ExportAttribute("deviceProtocolString")]
NSMutableAttributedString DeviceProtocolString{ [Bind("deviceProtocolString")]get; set; }
[ExportAttribute("configParams")]
NSMutableAttributedString configParams{ [Bind("configParams")]get; set; }
[Export ("openDevice")]
bool OpenDevice();
[Export ("closeDevice")]
bool CloseDevice();
[Export ("isDeviceConnected")]
bool IssDeviceConnected();
[Export ("getTrack1Masked")]
NSString GetTrack1Masked();
[Export ("getTrack2Masked")]
NSString GetTrack2Masked();
[Export ("getTrack3Masked")]
NSString getTrack3Masked();
[Export ("getMaskedTracks")]
NSString GetMaskedTracks();
[Export ("getTrack1")]
NSString GetTrack1();
[Export ("getTrack2")]
NSString GetTrack2();
[Export ("GetTrack3")]
NSString GetTrack3();
[Export ("getMagnePrint")]
NSString GetMagnePrint();
[Export ("getMagnePrintStatus")]
NSString GetMagnePrintStatus();
[Export ("getDeviceSerial")]
NSString GetDeviceSerial();
[Export ("getMagTekDeviceSerial")]
NSString GetMagTekDeviceSerial();
[Export ("getFirmware")]
NSString GetFirmware();
[Export ("getDeviceName")]
NSString GetDeviceName();
[Export ("getDeviceCaps")]
NSString GetDeviceCaps();
[Export ("getDeviceStatus")]
NSString GetDeviceStatus();
[Export ("getTLVVersion")]
NSString GetTLVVersion();
[Export ("getDevicePartNumber")]
NSString GetDevicePartNumber();
[Export ("getKSN")]
NSString GetKSN();
[Export ("getTagValue:")]
NSString SetTagValue(UInt32 tag);
[Export ("getCapMSR")]
NSString GetCapMSR();
[Export ("getCapTracks")]
NSString GetCapTracks();
[Export ("GetCapMagStripeEncryption")]
NSString GetCapMagStripeEncryption();
[Export ("sendCommandToDevice:")]
void sendCommandToDevice(NSString pData);
[Export ("setDeviceProtocolString:")]
void SetDeviceProtocolString(NSString pData);
[Export ("setConfigurationParams:")]
void SetConfigurationParams(NSString pData);
[Export ("listenForEvents:")]
void listenForEvents(UInt32 _event);
[Export ("getDeviceType")]
int GetDeviceType();
[Export ("getCardPANLength")]
int GetCardPANLength();
[Export ("getSessionID:")]
NSString GetSessionID();
[Export ("getResponseData")]
NSString GetResponseData();
[Export ("getCardName")]
NSString GetCardName();
[Export ("getCardIIN")]
NSString getCardIIN();
[Export ("getCardLast4")]
NSString GetCardLast4();
[Export ("getCardExpDate")]
NSString GetCardExpDate();
[Export ("getCardServiceCode")]
NSString GetCardServiceCode();
[Export ("getCardStatus")]
NSString GetCardStatus();
[Export ("getTrackDecodeStatus")]
NSString GetTrackDecodeStatus();
[Export ("getResponseType")]
NSString GetResponseType();
[Export ("setDeviceType:")]
void SetDeviceType(UInt32 deviceType);
[Export ("isDeviceOpened")]
bool IsDeviceOpened();
[Export ("clearBuffers")]
void ClearBuffers();
[Export ("getBatteryLevel")]
long GetBatteryLevel();
[Export ("getSwipeCount")]
long GetSwipeCount();
[Export ("getSDKVersion")]
NSString GetSDKVersion();
[Export ("getOperationStatus")]
NSString GetOperationStatus();
[Export ("getEncryptionStatus")]
NSString GetEncryptionStatus();
}
}
そして最後に私のlinkwithファイルは次のとおりです
using System;
using MonoTouch.ObjCRuntime;
[assembly: LinkWith ("libMTSCRA.a", LinkTarget = LinkTarget.ArmV7 | LinkTarget.ArmV6 | LinkTarget.Simulator,
Frameworks = "AudioToolbox ExternalAccessory Foundation", ForceLoad = true)]
ライブラリを通常の monotouch Ipad プロジェクトにインポートすると、次のビルド出力が得られます。(完全な出力ではなく、文字数が不足しています)
Compiling to native code\
/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp7967f93f.tmp/System.Core.dll.armv7.o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp7967f93f.tmp/MonoTouch.Dialog-1.dll.armv7.o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp7967f93f.tmp/mscorlib.dll.armv7.o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp7967f93f.tmp/System.dll.armv7.o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp7967f93f.tmp/monotouch.dll.armv7.o /Users/dylanvdmerwe/Desktop/Projects/Affinion/trunk/CreditCardReaderIDynamoIpadDemo/CreditCardReaderIDynamoIpadDemo/obj/Release/mtouch-cache/main..armv7.cache.V7WUEG1CYIbzGQyRJadXq2I83LQ=.o /Users/dylanvdmerwe/Desktop/Projects/Affinion/trunk/CreditCardReaderIDynamoIpadDemo/CreditCardReaderIDynamoIpadDemo/obj/Release/mtouch-cache/registrar.armv7.cache.oz4CLqSH9MR1-CuVC2OCHFSKN8A=.o -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp7967f93f.tmp/CreditCardReaderIDynamoIpadDemo -framework CFNetwork -framework Foundation -framework UIKit -framework AudioToolbox -framework QuartzCore -framework CoreGraphics -framework ExternalAccessory -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch -L/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib -force_load /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp7967f93f.tmp/libMTSCRA.a\
Undefined symbols for architecture armv7:\
"operator delete(void*)", referenced from:\
-[MTSCRA hexStringtoBytes:] in libMTSCRA.a(MTSCRA.o)\
hasData(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*)in libMTSCRA.a(MTSCRA.o)\
composeCommand(int, long*, int, unsigned char*, int, int*)in libMTSCRA.a(MTSCRA.o)\
AudioReader::processSamples(long) in libMTSCRA.a(AudioReader.o)\
AudioReader::copyResponseData() in libMTSCRA.a(AudioReader.o)\
AudioReader::initData() in libMTSCRA.a(AudioReader.o)\
AudioReader::tlvDecode(int*) in libMTSCRA.a(AudioReader.o)\
...\
"operator new[](unsigned long)", referenced from:\
-[MTSCRA hexStringtoBytes:] in libMTSCRA.a(MTSCRA.o)\
hasData(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*)in libMTSCRA.a(MTSCRA.o)\
composeCommand(int, long*, int, unsigned char*, int, int*)in libMTSCRA.a(MTSCRA.o)\
AudioReader::copyResponseData() in libMTSCRA.a(AudioReader.o)\
AudioReader::manchesterDecodeUartforResponseData(int, unsigned char*)in libMTSCRA.a(AudioReader.o)\
AudioReader::ByteArrayToHex(unsigned char*, int)in libMTSCRA.a(AudioReader.o)\
AudioReader::manchesterDecodeUart(int, int*)in libMTSCRA.a(AudioReader.o)\
...\
"operator new(unsigned long)", referenced from:\
AudioReader::processSamples(long) in libMTSCRA.a(AudioReader.o)\
AudioReader::processSamples(long) in libMTSCRA.a(AudioReader.o)\
"___cxa_begin_catch", referenced from:\
-[MTSCRA getConfigurationParams:] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA setCardData:] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getCardIINFromMaskTracks] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getCardLast4FromMaskTracks] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getMaskedPAN] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getTrack1AdditionalInfo] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getTrack2AdditionalInfo] in libMTSCRA.a(MTSCRA.o)\
...\
"___cxa_end_catch", referenced from:\
-[MTSCRA getConfigurationParams:] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA setCardData:] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getCardIINFromMaskTracks] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getCardLast4FromMaskTracks] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getMaskedPAN] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getTrack1AdditionalInfo] in libMTSCRA.a(MTSCRA.o)\
-[MTSCRA getTrack2AdditionalInfo] in libMTSCRA.a(MTSCRA.o)\
...\
"___gxx_personality_sj0", referenced from:\
AudioReader::processSamples(long) in libMTSCRA.a(AudioReader.o)\
AudioReader::processSamples(long) in libMTSCRA.a(AudioReader.o)\
AudioReader::processSamples(long) in libMTSCRA.a(AudioReader.o)\
AudioReader::processSamples(long) in libMTSCRA.a(AudioReader.o)\
ld: symbol(s) not found for architecture armv7\
collect2: ld returned 1 exit status\
\
error MT5202: Native linking failed. Please review the build log.\
\
---------------------- Done ----------------------\
\
Build: 1 error, 4 warnings\
また、linkwith ファイルに AudioUnit を追加しようとしましたが、framework not found エラーが発生します。また、CoreAudio を同じ効果に追加しようとしました。
コード ダンプについては申し訳ありません。誰かが私を助けてくれることを願っています。今穴にはまっています。