Where is syscall_sw.h in Mac OS X? - xcode

Where is the file syscall_sw.h in Mac OS X?
I'm using it to program the classes found within in assembly, but I can only find the file on the Internet. I want to find it on my actual operating system filesystem. I've downloaded all of XCode and installed the Components and Documentation, but I still can't find the file.

It is not a public* header -- it can, however, be found in the kernel source code:
http://www.opensource.apple.com/source/xnu/xnu-2050.9.2/osfmk/kern/syscall_sw.h
*: Indicating that you should not need it unless you're working in the kernel.

Related

Missed Headers folder in OpenCl.framework Mac OS Mojave

I am trying to stark work with OpenCl framework on my MacBook, and Mac OS has the framework installed, but there is no needed header cl.hpp I want to work with. I have downloaded the header from Khronos OpenCL Registry, but now I do not know where to paste it since there is no Headers folder in /System/Library/Frameworks/OpenCL.framework/, I've tried to find present headers (cl.h) with find in Terminal, but unsuccessful. What can I do?
Now I fixed the problem, I noticed that cmake finds OpenCL at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenCL.framework. There is folder Headers.

What is the difference between the mach headers in /usr/include and the ones in the SDK?

In MacOS X there are Mach kernel headers located both at
/usr/include/mach and
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach
These headers do not match: they provide different APIs (functions, types, etc).
What is the difference between them?
When should I use which?
From Apple's documentation for the Kernel framework:
The Kernel Framework provides the APIs and support for kernel-resident device drivers and other kernel extensions.
If that's not what you're programming, then you shouldn't use it (including header files from it).
What is the difference between them:
Firstly a bit of context to the usr folder:
/usr
Contains non-essential command-line binaries, libraries, header files, and other data that are not system critical (meaning the system can reboot without needing these files). This folder is a UNIX-specific directory which has been inherited by OS X.
/usr/include
The directory for 'header files' needed for compiling user space source code.
Type man hier in terminal, this will provide you with file system hierachy and a description for each directory.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
The more recent versions of Xcode don’t use headers from "/usr/include/" anymore. Instead Xcode uses the headers from the SDKs embed in it's package.
Why are they different?
This is because they are almost certainly different versions, both came from different installation sources so the chances that they will be the same is highly unlikely.
When should I use which?
This answer does depend what you're trying to do?
You should use the Xcode package SDKs if you are developing in Xcode, otherwise use /usr/include/ if you're developing outside of Xcode.
Sources:
Linux Exploring the File System
Linux Filesystem Hierarchy
Apple File System Basics

Mac compiler on windows

Is it possible to develop cross-platform application on Windows and can also compile for Mac OS X from Windows? I have checked Qt but that requires one to compile from Mac using Xcode.
If this is your priority then one option would be Java as at least a jar file built on one platform can be run on another.
If however you're talking about C or C++...
If you are creating a small command line tool then you might be able to make this work with gcc and a cross compiler, but I think it would be a lot of work.
If however you are wanting to create a GUI application I would urge you to give up now. There are so many issues - you'd have to use Carbon or Cocoa APIs which you can't build for on any other platform, you'd have to link against frameworks which won't exist on your compilation host, you won't be able to easily generate .plist files. Qt won't help as you need to be able to build it, which relies on these same frameworks.
In short, there's no alternative to building on an actual mac.
Furthermore, when it comes to fixing bugs, you will absolutely have to do this on a mac (either physical or virtual).
From what I know , in general you do need a mac to make the executable , even for a simple ansi c program you need gcc for mac.
You can create MacPorts Portfile.(If your application is open source)
A MacPorts port is a set of specifications contained in a Portfile
that defines an application, its characteristics, and any files or
special instructions required to install it. This allows you to use a
single command to tell MacPorts to automatically download, compile,
and install applications and libraries.
Take a look at IMCROSS.
IMCROSS is a simple, scripted method of installing cross-compilers and
cross-compiled libraries on a Linux (or possibly other *nix) system,
so that you can develop programs targeted to run on Microsoft Windows
and Mac OS X at the same time and in the same environment as you
develop Linux versions of those programs.
You can certainly do this using Real Studio. It can create Mac OS X applications on Windows without any trouble.
It cross-compiles for Windows, OS X and Linux. And it does it from any platform. It also can create web apps.
Sounds like you should check it out.

SCTP missing include file on OSX?

I was messing around with sockets, and I wanted to test out using the SCTP protocol on my mac.
However, when I try to include the file netinet/sctp.h the compiler gives me a 'file not found' error.
So I did some digging, and sure enough, there is no include file for netinet/sctp.h on Mac OSX Lion. Why is that, when I can set up a socket with IPPROTO_SCTP, and it builds fine?
So, in summary, I have two questions:
Where are the headers for SCTP on Mac OSX?
Can I still set up a SCTP server without the proper headers? If so, how?
On Lion IPPROTO_SCTP is defined in netinet/in.h - that's why it worked just fine since you probably included netinet/in.h directly or indirectly. However, it is only present in Lion, not in any earlier OS X versions. (Note that netinet/sctp.h is not part of POSIX an I don't think it's portable)
Looks like you could do
brew install libusrsctp
And you will see the installed header here, although it is probably a different implementation with a different name:
cat /usr/local/Cellar/libusrsctp/0.9.5.0/include/usrsctp.h

Creating cursor rsrc files on Mac from png

I want to create cursor rsrc files on the Mac from png files. The application that uses the cursors requires it to be in a .rsrc format and I cannot change that. Does anybody know of any way I can create the cursor .rsrc files from png images.
You can use Rezilla to edit resource files on Mac OS X, it has a CURS (and crsr) editor among others. It's a PowerPC binary but it runs well under rosetta on intel.
Also, you don't create a CURS resource file, you create a resource file and add as many CURS resources to it as you need. Resource forks are generic and can contain any number/kind of resources.
Its been a long time since I've thought about MacOS resource forks. Are you using the classic MacOS (i.e. before MacOS X)?
As I recall, ResEdit was the application most often used to manipulate the resource fork of a classic Mac application. I know it can edit cursor resources, but I don't recall if it can read PNG files. You may need to convert the files to GIF.
ResEdit is a Classic MacOS application. MacOS X prior to 10.5 could run Classic apps in emulation, but in 10.5 this support has been removed. You'd need to find a system either running the classic MacOS directly, or running 10.4 with Classic installed.
According to this link http://www.macfixit.com/article.php?story=20060621071707921 I need to have a Power PC Mac to run Mac classic. Is this right? I have a Intel Mac running Mac OS 10.4.11 . Are there any other tools capable of running on Intel Mac and could help me create CURS rsrc files. I tried using ResKnife but it didnt seem to have an option to create CURS rsrc files.
If by .rsrc file you mean a standard Mac resource file, you can use the Resource Manager to save the image in a file of the appropriate format.

Resources