Commit graph

113 commits

Author SHA1 Message Date
rfm
5fa8a06531 Hide some mistakenlt external symbols 2025-02-09 12:49:56 +00:00
rfm
05d34f1a30 revert 2025-01-09 06:06:12 +00:00
rfm
6b5b1f1ed0 Fix leaks 2025-01-08 22:32:14 +00:00
Hugo Melder
bde70572c9 GSFFIInvocation: Always use objc_msg_lookup
The current implementation skips hidden classes, which breaks KVO.
It turns out that GSGetMethod + method_getImplementation is about
50% slower than objc_msg_lookup (gnustep-2.2 ABI).
2024-12-13 03:29:30 -08:00
rfm
bdad4987ae Fix leaked FFI structure argument/returntype information 2024-11-15 15:43:47 +00:00
rfm
6667842dd5 Update FSF address as requested by Gregory 2024-11-07 13:37:59 +00:00
Richard Frith-Macdonald
c76ebf2962 Replaced IF_NO_GC() macro calls with the more descriptive IF_NO_ARC()
and deprecate it.  Searched for and removed obsolete references to
garbage collection in comments and documentation.
2022-02-17 10:08:18 +00:00
Frederik Seiffert
35ef9423e0 Annotate callback functions with __stdcall on Windows
Fixes crash on exit on Windows x86.
2021-08-08 17:27:40 +02:00
Frederik Seiffert
55da62c1c1 Add missing import declaration on runtime declarations
Fixes warnings when building for Windows MSVC.
2021-08-08 17:27:40 +02:00
Frederik Seiffert
abfe4e2a04 Use native threading and locking APIs on Windows
Removes dependency on pthread library and uses fast Slim Reader/Writer (SRW) locks for NSLock/NSRecursiveLock/NSCondition/NSConditionLock as well as all internal locks. Adds GS_MUTEX_*() macros in GSPThread.h, that are being used for all internal locking instead of pthread APIs.

Also adds support for thread priorities on Windows, fixes method signature of +[NSThread setThreadPriority:] to match Apple platforms, and adds error handling in same method.
2021-07-29 14:22:27 +02:00
Gregory John Casamento
753c907938 Fix address for FSF and License name in all headers in base 2019-12-09 18:36:00 -05:00
Richard Frith-MacDonald
2084f2f49b remove some unused code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39494 72102866-910b-0410-8b05-ffd578937521
2016-03-09 13:24:44 +00:00
Richard Frith-MacDonald
37acb000fd consistency tweaks and simplify documentation flags in make files by automatically adding most work map entries.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37629 72102866-910b-0410-8b05-ffd578937521
2014-01-23 09:36:37 +00:00
Wolfgang Lux
a1843ff254 Generate useful error message when no best typed selector can be found
in forwarding callback.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35784 72102866-910b-0410-8b05-ffd578937521
2012-11-05 15:16:30 +00:00
Richard Frith-MacDonald
e6c15aef54 crude KVO setter for structs
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35324 72102866-910b-0410-8b05-ffd578937521
2012-07-27 16:48:49 +00:00
Richard Frith-MacDonald
4555af88c0 fi for bug #36706
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35278 72102866-910b-0410-8b05-ffd578937521
2012-07-09 15:31:12 +00:00
Richard Frith-MacDonald
d3b4830a65 try to work round selinux restrictions on invocations
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34660 72102866-910b-0410-8b05-ffd578937521
2012-01-29 16:57:06 +00:00
Richard Frith-MacDonald
4d0364836b fix for incorrect types comparison
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34591 72102866-910b-0410-8b05-ffd578937521
2012-01-19 10:12:03 +00:00
Richard Frith-MacDonald
f7b8b22bae trivial formating tweaks ... add missing white space
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34374 72102866-910b-0410-8b05-ffd578937521
2012-01-01 07:38:53 +00:00
Richard Frith-MacDonald
4baaff38cb Attempt workaround for runtime providing insufficient information in callback.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33814 72102866-910b-0410-8b05-ffd578937521
2011-09-07 09:42:50 +00:00
Richard Frith-MacDonald
8c89a47a8b fix includes for gcc-4.6
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33069 72102866-910b-0410-8b05-ffd578937521
2011-05-19 08:19:24 +00:00
Richard Frith-MacDonald
b2649e0526 old/new objc api updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33027 72102866-910b-0410-8b05-ffd578937521
2011-05-12 16:03:08 +00:00
Richard Frith-MacDonald
1baa775684 improve typed selector handling
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32642 72102866-910b-0410-8b05-ffd578937521
2011-03-18 06:32:47 +00:00
Richard Frith-MacDonald
1cfe74bbc6 fix typo
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32398 72102866-910b-0410-8b05-ffd578937521
2011-02-27 23:34:57 +00:00
Richard Frith-MacDonald
5168bd5e2e simplify typed selector usage.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32396 72102866-910b-0410-8b05-ffd578937521
2011-02-27 23:29:25 +00:00
Nicola Pero
e4cad664d8 Implemented lookup of selector with a type for __GNU_LIBOBJC__. We can simply use sel_copyTypedSelectorList() to access the full list of selectors with a certain name.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32296 72102866-910b-0410-8b05-ffd578937521
2011-02-22 13:34:49 +00:00
Richard Frith-MacDonald
38670c0a08 OSX compatibility changes and other minor tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32279 72102866-910b-0410-8b05-ffd578937521
2011-02-22 07:05:36 +00:00
David Chisnall
18ccb48ece Some changes to method type lookup when forwarding. Alway use the compiler-supplied type information if it exists - this is guaranteed to by the correct type encoding for the call frame and lets us deconstruct it correctly. We can then fail gracefully later on when trying to invoke the selector if the types in the callee don't match, rather than by reading nonsense from the stack now.
When using the GNUstep runtime, use the safe mechanism for checking whether there is more than one typed selector, and only use that as a guess if it is safe to do so.  With the GCC runtime, we are still stuck using the API that it is impossible to use safely (we might be better off just giving up at this point), but now we call this after -methodSignatureForSelector:, so the app developer gets a chance to do the right thing before we do the wrong thing.

Also changed the assert to throw an exception if no type signature can be found.  This behaviour is consistent with Mac OS X.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32257 72102866-910b-0410-8b05-ffd578937521
2011-02-21 11:05:33 +00:00
Richard Frith-MacDonald
4ed081d410 Replace old code directly referencing class_pointer ivar with calls to the new runtime API treating objects as opaque pointers.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32243 72102866-910b-0410-8b05-ffd578937521
2011-02-20 12:28:12 +00:00
Richard Frith-MacDonald
c7eeb1bb08 Use GSObjCRuntime functions for selector types until/unless we can get
a standard runtime API that handles them.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32240 72102866-910b-0410-8b05-ffd578937521
2011-02-20 07:58:11 +00:00
Nicola Pero
0a0a147ae9 Updated for GCC 4.6
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31771 72102866-910b-0410-8b05-ffd578937521
2010-12-24 17:19:40 +00:00
Nicola Pero
30f098f9f8 Updated code to compile with GCC 4.6 and the new GNU Objective-C runtime
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31765 72102866-910b-0410-8b05-ffd578937521
2010-12-23 02:23:05 +00:00
Richard Frith-MacDonald
79eac15152 fix crash due to dereferencin a null pointer.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31570 72102866-910b-0410-8b05-ffd578937521
2010-10-27 22:19:18 +00:00
David Chisnall
704532b50c Don't access isa directly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31560 72102866-910b-0410-8b05-ffd578937521
2010-10-25 14:40:09 +00:00
Eric Wasylishen
4eba67f87b Remove dead code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31434 72102866-910b-0410-8b05-ffd578937521
2010-09-28 23:27:46 +00:00
Richard Frith-MacDonald
46076fe15b fixup to get proxies working again
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31275 72102866-910b-0410-8b05-ffd578937521
2010-09-09 21:10:47 +00:00
David Chisnall
4488708e84 Fix a load of warnings from implicit function declarations. A lot were caused by ctype.h and string.h stuff being used everywhere in GNUstep but not included anywhere - they're now included in common.h (at least string.h should also be in Foundation.h - on OS X it is implicitly included via some chain of things from Foundation.h).
All of the sel_* stuff is now replaced with the newer APIs.  As a side-effect, a blob of code that was copied-and-pasted all over GNUstep has now been moved into ObjectiveC2 and just called.

Class posing with libobjc2 will now throw an exception, rather than just aborting.  



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31268 72102866-910b-0410-8b05-ffd578937521
2010-09-09 16:30:10 +00:00
David Chisnall
7a80adeb9b A huge blob of changes to make -base build with libobjc2, without using the old libobjc2 headers.
Most of these changes involve simply removing direct manipulation of any runtime structures and replacing them with runtime function calls.  For example class->name becomes class_getName(class) and so on.

libobjc2, like the Apple runtime, the NeXT runtime, and every version of the Objective-C spec, calls the class pointer in id isa.  A few files now have #define class_pointer isa at the top.  This line replaces class_pointer in the old GNU libobjc headers with isa so either class_pointer or isa can be used for accessing the class of an object.  Note: object_getClass() should be used in most cases because, in some future version of the runtime, this will skip things like lock classes and other hidden classes (e.g. KVO classes).

All of the old forwarding stuff has been removed.  Most of this stuff followed convoluted code paths that ended with an exception.  A few simply broke in exciting ways.  Hopefully no one has used them for the last ten years or so, but we can bring them back with some #ifndef stuff if they're really needed by anyone.

There is currently a bug in configure, which prevents dladdr() from being detected, so you need to manually tweak config.h to build - I have not fixed the fall-back code in objc-load.m to work with libobjc2, I just added a new version that uses the loader's functionality directly.  

Although -base now builds, it builds with a lot of warnings.  <string.h> is missing from a lot of files, so memcpy() and strlen() generate implicit function declaration warnings.  

Additionally, libobjc2 does still provide the sel_{get,register}_*() functions, but they're wrappers around the newer API ones.  These are deprecated and are not exposed in the headers.  Although they work, we should be replacing them with the libobjc2 versions as soon as possible.

This incorporates a patch by Eric.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31265 72102866-910b-0410-8b05-ffd578937521
2010-09-09 15:06:09 +00:00
Eric Wasylishen
ed30e20c20 Fix base build with libobjc2
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30988 72102866-910b-0410-8b05-ffd578937521
2010-07-16 18:00:45 +00:00
David Chisnall
e8e94cfcfb Fix build with libobjc2.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30967 72102866-910b-0410-8b05-ffd578937521
2010-07-15 09:59:01 +00:00
Richard Frith-MacDonald
fe4fcbe5a1 remove old GC code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30653 72102866-910b-0410-8b05-ffd578937521
2010-06-10 15:42:54 +00:00
Richard Frith-MacDonald
2b8d035def add comment
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30618 72102866-910b-0410-8b05-ffd578937521
2010-06-08 16:17:56 +00:00
Richard Frith-MacDonald
bf8c2e4784 improve fix for broken forwarding
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30617 72102866-910b-0410-8b05-ffd578937521
2010-06-08 15:46:20 +00:00
Richard Frith-MacDonald
94fdf2eb27 simplify last change
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30616 72102866-910b-0410-8b05-ffd578937521
2010-06-08 05:03:14 +00:00
Richard Frith-MacDonald
4e0ef853d3 rework memory management for ffi
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30611 72102866-910b-0410-8b05-ffd578937521
2010-06-07 20:38:19 +00:00
Richard Frith-MacDonald
23fb22bf40 Fix invocation breakage.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30606 72102866-910b-0410-8b05-ffd578937521
2010-06-07 14:43:08 +00:00
David Chisnall
56d015fcd1 Work around some GNU runtime headers spelling isa incorrectly as 'class_pointer'.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30596 72102866-910b-0410-8b05-ffd578937521
2010-06-07 02:47:53 +00:00
David Chisnall
5f3c8920bd ...and also don't break when sending messages to proxies.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30594 72102866-910b-0410-8b05-ffd578937521
2010-06-07 00:35:28 +00:00
David Chisnall
5e9e5f7de8 Don't infinite loop when trying to send an unimplemented message to an object that doesn't implement -methodSignatureForSelector:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30593 72102866-910b-0410-8b05-ffd578937521
2010-06-07 00:28:52 +00:00
David Chisnall
775dd86b02 Simplification of some invocation code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30531 72102866-910b-0410-8b05-ffd578937521
2010-06-01 19:35:26 +00:00