Targets for Mac - Old and Deprecated for historical reasons

I have a lot of old, now entirely deprecated code, which uses declares, been using the trial version of realBasic for a very long time ( maybe 10 years ), mostly tinkering with how it works each time I see a new 30 day trial comes out (really love the new perpetual trial model ). I find it interesting to take a function using declares (often in the windows declare library) and see if I can get it working both on a Mac, and I have code which declares against the old interface lib. Generally it uses logic along the lines of “#if not TargetCarbon” or “#if not TargetMachO” which works just fine, I just have no idea what is intended by such reverse logic, and while this seems like something many very old threads discuss, I’ve yet to really see a overview which makes why a given target is used that makes sense.

What I’d like to do if possible is keep the old code as I do this for Cocoa, and put in deprecated targets so if a function were to be copy pasted into an ancient version of realbasic, it would (in theory) still work. It technically does not have to work, since in reality I’m not going to do that.

So my question is how should the Targets be structured. I’ve tried to google this and I might have figured it out to a degree, but it’s hard to know since a lot of this code isn’t going to actually be used anymore. I am trying to work from the names of the libraries being called against, since usually interfaceLib for example means it’s old pre carbon code, so I think I have a practical solution.

#If TargetMacOS // all the code here is mac only
#if TargetCocoa
Declare Function someFunction Lib "Foundation" selector "stringValue" (someRef as Ptr) as CFStringRef
Declare Function someFunction2 Lib "Cocoa" selector "stringValue" (someRef as Ptr) as CFStringRef

#elseif TargetCarbon and TargetMachO // deprecated MachO Carbon
Declare Function someFunction Lib "Carbon" (someRef as Ptr) As string

#elseif TargetCarbon and not TargetMachO // PEF deprecated
Declare Function someFunction Lib "CarbonLib" (someRef as Ptr) As string

#elseif TargetMacOSClassic // deprecated of course , same as TargetPPC
Declare Function someFunction Lib "InterfaceLib" (someRef as Ptr) As string


I know this isn’t practical, rather it’s just for reference. so I might just make up targets ( I think I can do that as I don’t think there ever was TargetPEF )

How Would Target68k fit into the above? Did the very old pre-powerPC chips use interfaceLib, or was there something even older before my time. There are other targets, but they seem to overlap in many different ways with these categories. Is it true that Carbon and CarbonLib were just libraries apple provided to let us keep using very old code which built against interfaceLib, as the declared functions tend to be almost the same.

I am assuming EVERYTHING is effectively TargetCocoa now, which makes all of this a lot simpler, are there other targets which are not deprecated which are still sub-categories of TargetMacOS.

I’d use the Target that specifies the OS + the one that specifies the project type
TargetMacOS + TargetDesktop / TargetConsole / TargetWeb are really the best ones to combine now

The rest you can drop as they wont ever be true unless you go back to old versions of Xojo / REAL Studio
But then some of those Targets wont even exist if you go back far enough so you’d get compile errors