views:

39

answers:

2

I am trying to compile a library originally written for Cocoa. Things are good until it looks for the function marg_setValue(). It says there is a syntax error before char in

marg_setValue(argumentList,argumentOffset,char,(char)lua_toboolean(state,luaArgument));

(it's talking about the third argument, not (char) )

I am trying to port LuaObjectiveCBridge to the iPhone. It has two choices, either using Runtime or Foundation. I have discovered there are some problems with foundation so I am trying runtime. But the compiler is not co-operating.

A: 

The modern Objective-C ABI/API is available on Cocoa Touch. It lacks some of the legacy features of the 32-bit desktop runtime (namely, ones that were horrendously fragile).

marg_setValue() and friends are a part of that legacy runtime that is not supported in Objective-C 2.0. It was -- always was -- broken anyway. You aren't missing much.

The real question is: What are you trying to do?

bbum
expanded question and answered your question
John Smith
Since ffi isn't available on the device, you are pretty much left with either using NSInvocation(Foundation) or rolling your own ARM assembly to setup the stack frame and make the call.
bbum
marg_setValue is still part of the Objective-C API. At least, it's still in the documetation. See http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html#//apple_ref/doc/uid/TP40001418-CH1g-BBCHBDJC . Admittedly, it didn't show up in a spotlight search of my Mac.
JeremyP
Have a look at the header file; that API is surrounded by `#if !__OBJC2__`. The docs are wrong. Bug filed (rdar://7980744).
bbum
A: 

Check to see if you can get rid of the marg_XXX macros:

  • they are deprecated and not considered as reliable.
  • marg_list is to be used with objc_msgSendv which is absent from modern runtime.

I suggest to go with NSInvocation. It is pretty simple to use, and powerful enough for a bridge. Check this entry for completeness.

Laurent Etiemble