4

I created a simple external using the LiveCode iOS externals SDK. The test.lcidl file is as follows:

external test

function testMyExternal
    return boolean

The test.mm file is as follows:

bool testMyExternal(void) {
    return true;
}

The test.ios file is the default Foundation framework.

This is about as simple as it gets but it won't compile... why not?

juergen d
  • 201,996
  • 37
  • 293
  • 362
Monte Goulding
  • 2,380
  • 1
  • 21
  • 25

2 Answers2

3

This question was asked on a LiveCode listserve and I'm asking and answering here because the answer will be useful for others.

There are a few problems here:

First is the ios file which specifies frameworks and libraries to compile the external against includes Foundation framework yet the use objc-objects clause is not specified in the .lcidl file. If you don't want to use objective c objects then remove the foundation framework from the .ios file.

Second is the file is a .mm which is Objective-C++ and the use c++-naming clause is not specified. If you don't want C++ you can change the .mm to .c for C or .m for Objective-C.

More detail can be found in section 6.3 of the documentation

Monte Goulding
  • 2,380
  • 1
  • 21
  • 25
2

Monte managed to answer his own question but in this case the external is a .mm file which means its obj-c++. This means you need to add use c++-naming in the lcidl file otherwise the glue code that's generated will look for C-style (unmangled) names (C++ 'mangles' names of functions to include the typing information so that they can be overloaded)

Benjamin Beaumont
  • 910
  • 1
  • 6
  • 14