On Mon, Aug 07, 2017 at 09:23:10PM +0200, Charles A. Roelli wrote:
On 06/08/2017 23:29, Alan Third wrote:
I believe we can make this slightly neater:
enum NSScrollerStyle {
NSScrollerStyleLegacy = 0,
NSScrollerStyleOverlay = 1
};
Strange, it doesn't work here:
We’ll just go with what works, then.
I’ve done a bit more reading up on this and I think I’ve misunderstood
how this works, and probably mislead you.
It seems these functions need to be declared as weak in the definition
of the library they’re supposed to be in. If we declare them in the
Emacs code‐base then the linker, reasonably, expects the functions to
be in the Emacs code‐base.
Maybe I'm also confused. I thought we would be able to do this,
since:
- At link time, the symbol is marked as a weak reference, to be
resolved at runtime.
- At runtime, the dynamic linker resolves the reference to the weak
symbol, setting it to NULL if it isn't available. Normally the
definition of the function will be found in a dynamic library that
is part of macOS (as far as I understand).
The Apple compiler/linker should be capable of doing this, supposedly,
as long as you give the magical -Wl,-U,_symbol command line arguments
to the linker. See also https://stackoverflow.com/a/34983229.
That’s quite a good description. I guess that we want to do what
you’re suggesting, then. I’m not sure how, though. I’ll try to have a
look through configure.ac to see if I can work it out sometime over
the weekend.
I'd like to check, but wouldn't I need to either:
a) Statically link libraries Emacs depends on, or
b) Include the dependent libraries in the app bundle?
Yes, I suppose so. I kind of assumed it would statically link at least
some of them, but I guess not.
I’ve had a look at the build scripts for emacsformacosx.com, but I
don’t understand what they’re doing.
I’ve attached what I have so far, which I think includes all your
changes except for the requirements for linker arguments.
Unfortunately master doesn’t build here now because of some other
problem so it’s untested.