Author Topic: Calling exiftool from Cocoa  (Read 175 times)

DesertNomad

  • Jr. Member
  • **
  • Posts: 14
Calling exiftool from Cocoa
« on: October 02, 2018, 07:46:50 PM »
#include <iostream>
#include "ExifTool.h"   //  this is a .mm file so that we can include C++ code/structures

@implementation MyClass

-(id)myInit
{
    if (self = [super init])
    {
        ExifTool* tool = new ExifTool("/Users/myusername/Tools/exiftool");
        delete tool;
    }
}
This is obviously just a test but in the "new ExifTool" line I get a crash:

dyld`dyld_fatal_error:
    0x7fff5fc01074 <+0>: int3   
->  0x7fff5fc01075 <+1>: nop   

Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)

dyld: Symbol not found: __ZN8ExifToolC1EPKcS1_
« Last Edit: October 02, 2018, 08:15:42 PM by DesertNomad »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 13669
    • ExifTool Home Page
Re: Calling exiftool from Cocoa
« Reply #1 on: October 02, 2018, 09:55:18 PM »
I assume you included the C++ source code files in your project?

Try a dummy C++ class to see if that works.  If it does, you could iteratively add variables/methods to it until you get the full ExifTool object -- this should let you figure out what specifically was the problem, although it may take a few iterations.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

DesertNomad

  • Jr. Member
  • **
  • Posts: 14
Re: Calling exiftool from Cocoa
« Reply #2 on: October 02, 2018, 10:59:56 PM »
t turns out that the C++ code files associated with this were getting copied into the app rather than compiled. It works as expected. With just the header files there was no error, and a pretty cryptic crash.

Thank you.
« Last Edit: October 03, 2018, 06:46:02 AM by DesertNomad »