Xcode 7 & Externals

External developers... This forum's for you!

Xcode 7 & Externals

Postby sctell » Tue Apr 12, 2016 11:54 pm

Is it going to be possible to create externals using Xcode 7 with SC4.8?

I did a port of FMDB (sqlite database wrapper) many years ago and even now it's performance is really good but it would be nice to update it.

All the best

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Xcode 7 & Externals

Postby codegreen » Wed Apr 13, 2016 11:14 pm

Actually it's possible now -- in fact I just built one (which uses and EvalExprLong callback) to confirm this. So if you just want to do pure C/C++/Obj-C/Swift and Cocoa stuff, that all should work so long as you stick to building for recent system versions.

Where you'll likely run into problems though is if you try to use the Internals Toolbox (I haven't even bothered to try, since little that really uses it for anything but fetching the main globals block address would compile anyway, as it's mainly about getting and setting data related to 32-bit only Carbon APIs that aren't in the LLVM-based SDKs. I suppose with diligence you could probably jigger some Frankenstein headers together that might let you compile with it anyway if you really needed to...

Unfortunately Apple removed the ability to define your own templates starting in Xcode 4. I spent weeks hacking out how to make my own anyway (it was absurdly hellishly complicated) but then lost them in a pair of back-to-back HD failures. The format has changed again anyway I think...

Long story short though, there are not now nor will there likely be templates, so you'll either have to copy an existing project and upgrade/gut it, or build one from scratch (which isn't difficult, just boring).

If you're converting an older project look out for errors claiming the linker can't find various mystery paths that don't actually appear anywhere in your projects's hopelessly confusing mishmash of Xcode 7 settings -- to fix this just delete any linker search path entries that contain shell variables (but leave /Library/SuperCard alone). And of course you have to update the target architectures (removing any PPC and 64-bit x86, selecting 32-bit, changing to the 10.11 SDK, and switching to building with the LLVM compiler).

You'll also need to update any file that uses the pragma option alignment=mac68k directive. Just replace these with #pragma pack(2) and the corresponding alignment reset directives with #pragma pack().

After that it still throws some stupid warnings about main having non-standard parameter list, which you can ignore.

Does that make sense to you, or is this your first foray into Xcode 7? Sadly it's a UI abomination that beggars belief or description, but that's a rant for another day...

-Mark
codegreen
 
Posts: 1517
Joined: Mon Jul 14, 2008 11:03 pm

Re: Xcode 7 & Externals

Postby sctell » Wed May 11, 2016 10:50 am

codegreen wrote:Does that make sense to you, or is this your first foray into Xcode 7?


Just tried to create a test project and it compiles OK but crashes.


Here is where it crashes. Just trying to return a message to SC using

void SetResult(char *message)
{
PtrToHand(message, &par->returnValue, strlen(message) + 1);
}



Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreServices.CarbonCore 0x9d934f4f CSMemGetHandleSize + 40
1 com.apple.CoreServices.CarbonCore 0x9d934f11 GetHandleSize + 25
2 us.SuperCard.SuperCard 0x001e3425 makezerohand + 21
3 us.SuperCard.SuperCard 0x001ed7f1 xlookup + 2673
4 us.SuperCard.SuperCard 0x00271191 sendmes + 1217
5 us.SuperCard.SuperCard 0x000b060a factor + 2634
6 us.SuperCard.SuperCard 0x000ae370 expression + 176
7 us.SuperCard.SuperCard 0x0001d3e1 comput + 113
8 us.SuperCard.SuperCard 0x0001ade7 syscom + 679
9 us.SuperCard.SuperCard 0x00271241 sendmes + 1393
10 us.SuperCard.SuperCard 0x0026e7ce runblock + 4830
11 us.SuperCard.SuperCard 0x002719f6 sendmes + 3366
12 us.SuperCard.SuperCard 0x000bb73d spoteval + 3149
13 us.SuperCard.SuperCard 0x000bbb15 spotsend + 197
14 us.SuperCard.SuperCard 0x001991df contutil + 13327
15 us.SuperCard.SuperCard 0x0019a872 handletools + 2978
16 us.SuperCard.SuperCard 0x000a6ffd runedit + 1869
17 us.SuperCard.SuperCard 0x0000fd43 HandleEvent + 4499
18 us.SuperCard.SuperCard 0x00010998 main + 2504
19 us.SuperCard.SuperCard 0x000026b9 _start + 208
20 us.SuperCard.SuperCard 0x000025e8 start + 40



There are to many options in the build settings for me to get this right.

Could you provide a simple test example along the lines above that works, so I can look at the build settings?

Thanks in advance.


Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Xcode 7 & Externals

Postby codegreen » Wed May 11, 2016 1:26 pm

There are to many options in the build settings for me to get this right.

LOL! And they're so 'helpfully' arranged too, aren't they? :rofl:

I'm away from home right now, but I'll be happy to post a sample when I get back tomorrow...

-Mark
codegreen
 
Posts: 1517
Joined: Mon Jul 14, 2008 11:03 pm


Return to Xcode and the Internals Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest

cron