From 919f44f3a5b2d4989809c9357d2519a9811b45c9 Mon Sep 17 00:00:00 2001 From: R-Goc Date: Thu, 4 Dec 2025 18:12:06 +0100 Subject: [PATCH] LibCore: Explicitly export symbols from LibCore This patch adds explicit symbol export to LibCore. This leads to about 350 less symbols being exported. --- Libraries/CMakeLists.txt | 4 - Libraries/LibCore/AnonymousBuffer.h | 6 +- Libraries/LibCore/ArgsParser.h | 3 +- Libraries/LibCore/CMakeLists.txt | 4 +- Libraries/LibCore/ConfigFile.h | 3 +- Libraries/LibCore/DirIterator.h | 3 +- Libraries/LibCore/Directory.h | 3 +- Libraries/LibCore/ElapsedTimer.h | 3 +- Libraries/LibCore/Environment.h | 7 +- Libraries/LibCore/EventLoop.h | 9 +- Libraries/LibCore/EventLoopImplementation.h | 5 +- Libraries/LibCore/EventReceiver.h | 3 +- Libraries/LibCore/File.h | 3 +- Libraries/LibCore/FileWatcher.h | 5 +- Libraries/LibCore/IOSurface.h | 3 +- Libraries/LibCore/LocalServer.h | 3 +- Libraries/LibCore/MachPort.h | 3 +- Libraries/LibCore/MappedFile.h | 3 +- Libraries/LibCore/MimeData.h | 3 +- Libraries/LibCore/Notifier.h | 3 +- .../LibCore/Platform/ProcessStatistics.h | 3 +- .../LibCore/Platform/ProcessStatisticsMach.h | 3 +- Libraries/LibCore/Process.h | 3 +- Libraries/LibCore/Resource.h | 3 +- Libraries/LibCore/ResourceImplementation.h | 3 +- .../LibCore/ResourceImplementationFile.h | 3 +- Libraries/LibCore/SharedVersion.h | 9 +- Libraries/LibCore/Socket.h | 11 ++- Libraries/LibCore/SocketAddress.h | 3 +- Libraries/LibCore/StandardPaths.h | 3 +- Libraries/LibCore/System.h | 97 ++++++++++--------- Libraries/LibCore/SystemServerTakeover.h | 3 +- Libraries/LibCore/TCPServer.h | 3 +- Libraries/LibCore/ThreadEventQueue.h | 3 +- Libraries/LibCore/TimeZoneWatcher.h | 3 +- Libraries/LibCore/Timer.h | 3 +- Libraries/LibCore/UDPServer.h | 3 +- Libraries/LibCore/Version.h | 3 +- Meta/Lagom/CMakeLists.txt | 6 ++ 39 files changed, 143 insertions(+), 104 deletions(-) diff --git a/Libraries/CMakeLists.txt b/Libraries/CMakeLists.txt index a8ba22299b..dd9e9760f3 100644 --- a/Libraries/CMakeLists.txt +++ b/Libraries/CMakeLists.txt @@ -7,15 +7,11 @@ add_subdirectory(LibGC) add_subdirectory(LibHTTP) add_subdirectory(LibIPC) add_subdirectory(LibJS) -add_subdirectory(LibRegex) add_subdirectory(LibRequests) add_subdirectory(LibSyntax) add_subdirectory(LibTest) -add_subdirectory(LibTextCodec) add_subdirectory(LibThreading) add_subdirectory(LibTLS) -add_subdirectory(LibUnicode) -add_subdirectory(LibURL) add_subdirectory(LibWasm) add_subdirectory(LibWebSocket) add_subdirectory(LibXML) diff --git a/Libraries/LibCore/AnonymousBuffer.h b/Libraries/LibCore/AnonymousBuffer.h index 6030ee7509..afc65962d3 100644 --- a/Libraries/LibCore/AnonymousBuffer.h +++ b/Libraries/LibCore/AnonymousBuffer.h @@ -11,10 +11,12 @@ #include #include #include +#include namespace Core { -class AnonymousBufferImpl final : public RefCounted { +// TODO: Hide the implementation from ABI +class CORE_API AnonymousBufferImpl final : public RefCounted { public: static ErrorOr> create(size_t); static ErrorOr> create(int fd, size_t); @@ -33,7 +35,7 @@ private: void* m_data { nullptr }; }; -class AnonymousBuffer { +class CORE_API AnonymousBuffer { public: static ErrorOr create_with_size(size_t); static ErrorOr create_from_anon_fd(int fd, size_t); diff --git a/Libraries/LibCore/ArgsParser.h b/Libraries/LibCore/ArgsParser.h index eedd66e6eb..881d2e3b3e 100644 --- a/Libraries/LibCore/ArgsParser.h +++ b/Libraries/LibCore/ArgsParser.h @@ -10,12 +10,13 @@ #include #include #include +#include #include #include namespace Core { -class ArgsParser { +class CORE_API ArgsParser { public: ArgsParser(); diff --git a/Libraries/LibCore/CMakeLists.txt b/Libraries/LibCore/CMakeLists.txt index 49dcd4e081..7e3ecb80cf 100644 --- a/Libraries/LibCore/CMakeLists.txt +++ b/Libraries/LibCore/CMakeLists.txt @@ -89,8 +89,8 @@ if (APPLE) list(APPEND SOURCES IOSurface.cpp) endif() -ladybird_lib(LibCore core) -target_link_libraries(LibCore PRIVATE LibUnicode LibURL Threads::Threads) +ladybird_lib(LibCore core EXPLICIT_SYMBOL_EXPORT) +target_link_libraries(LibCore PRIVATE LibUnicode LibURL Threads::Threads LibTextCodec) if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") # NetBSD has its shm_open and shm_unlink functions in librt so we need to link that diff --git a/Libraries/LibCore/ConfigFile.h b/Libraries/LibCore/ConfigFile.h index ff72f12992..71836489ec 100644 --- a/Libraries/LibCore/ConfigFile.h +++ b/Libraries/LibCore/ConfigFile.h @@ -15,11 +15,12 @@ #include #include #include +#include #include namespace Core { -class ConfigFile : public RefCounted { +class CORE_API ConfigFile : public RefCounted { public: enum class AllowWriting { Yes, diff --git a/Libraries/LibCore/DirIterator.h b/Libraries/LibCore/DirIterator.h index be0fc341d0..24038f8bbb 100644 --- a/Libraries/LibCore/DirIterator.h +++ b/Libraries/LibCore/DirIterator.h @@ -8,10 +8,11 @@ #pragma once #include +#include namespace Core { -class DirIterator { +class CORE_API DirIterator { public: enum Flags { NoFlags = 0x0, diff --git a/Libraries/LibCore/Directory.h b/Libraries/LibCore/Directory.h index ae49583540..5066407905 100644 --- a/Libraries/LibCore/Directory.h +++ b/Libraries/LibCore/Directory.h @@ -14,13 +14,14 @@ #include #include #include +#include #include #include namespace Core { // Deal with real system directories. Any Directory instance always refers to a valid existing directory. -class Directory { +class CORE_API Directory { AK_MAKE_NONCOPYABLE(Directory); public: diff --git a/Libraries/LibCore/ElapsedTimer.h b/Libraries/LibCore/ElapsedTimer.h index 4baff0de3c..a68e0432aa 100644 --- a/Libraries/LibCore/ElapsedTimer.h +++ b/Libraries/LibCore/ElapsedTimer.h @@ -7,6 +7,7 @@ #pragma once #include +#include namespace Core { @@ -15,7 +16,7 @@ enum class TimerType { Coarse }; -class ElapsedTimer { +class CORE_API ElapsedTimer { public: static ElapsedTimer start_new(TimerType timer_type = TimerType::Coarse); diff --git a/Libraries/LibCore/Environment.h b/Libraries/LibCore/Environment.h index e6448c2d65..ae7ec6264d 100644 --- a/Libraries/LibCore/Environment.h +++ b/Libraries/LibCore/Environment.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace Core::Environment { @@ -58,18 +59,18 @@ EntryIterator entries(); size_t size(); -bool has(StringView name); +CORE_API bool has(StringView name); enum class SecureOnly { No, Yes, }; -Optional get(StringView name, SecureOnly = SecureOnly::No); +CORE_API Optional get(StringView name, SecureOnly = SecureOnly::No); enum class Overwrite { No, Yes, }; -ErrorOr set(StringView name, StringView value, Overwrite); +CORE_API ErrorOr set(StringView name, StringView value, Overwrite); ErrorOr unset(StringView name); ErrorOr put(StringView env); diff --git a/Libraries/LibCore/EventLoop.h b/Libraries/LibCore/EventLoop.h index 3b29ca856f..95fcca91e3 100644 --- a/Libraries/LibCore/EventLoop.h +++ b/Libraries/LibCore/EventLoop.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -42,7 +43,7 @@ class WeakEventLoopReference; // - Fork events, because the child process event loop needs to clear its events and handlers. // - Quit events, i.e. the event loop should exit. // Any event that the event loop needs to wait on or needs to repeatedly handle is stored in a handle, e.g. s_timers. -class EventLoop { +class CORE_API EventLoop { AK_MAKE_NONMOVABLE(EventLoop); AK_MAKE_NONCOPYABLE(EventLoop); @@ -102,7 +103,7 @@ private: class StrongEventLoopReference; -class WeakEventLoopReference : public AtomicRefCounted { +class CORE_API WeakEventLoopReference : public AtomicRefCounted { public: StrongEventLoopReference take(); @@ -118,7 +119,7 @@ private: Threading::RWLock m_lock; }; -class StrongEventLoopReference { +class CORE_API StrongEventLoopReference { public: ~StrongEventLoopReference(); @@ -135,6 +136,6 @@ private: WeakEventLoopReference* m_event_loop_weak; }; -void deferred_invoke(ESCAPING Function); +CORE_API void deferred_invoke(ESCAPING Function); } diff --git a/Libraries/LibCore/EventLoopImplementation.h b/Libraries/LibCore/EventLoopImplementation.h index 76212ccd64..80cec06700 100644 --- a/Libraries/LibCore/EventLoopImplementation.h +++ b/Libraries/LibCore/EventLoopImplementation.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include namespace Core { @@ -14,7 +15,7 @@ namespace Core { class EventLoopImplementation; class ThreadEventQueue; -class EventLoopManager { +class CORE_API EventLoopManager { public: static EventLoopManager& the(); static void install(EventLoopManager&); @@ -39,7 +40,7 @@ protected: EventLoopManager(); }; -class EventLoopImplementation { +class CORE_API EventLoopImplementation { public: virtual ~EventLoopImplementation(); diff --git a/Libraries/LibCore/EventReceiver.h b/Libraries/LibCore/EventReceiver.h index bb179b7a39..4f15fc74b7 100644 --- a/Libraries/LibCore/EventReceiver.h +++ b/Libraries/LibCore/EventReceiver.h @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace Core { @@ -35,7 +36,7 @@ public: \ return #klass##sv; \ } -class EventReceiver +class CORE_API EventReceiver : public AtomicRefCounted , public Weakable { // NOTE: No C_OBJECT macro for Core::EventReceiver itself. diff --git a/Libraries/LibCore/File.h b/Libraries/LibCore/File.h index 4678021d64..170f15d369 100644 --- a/Libraries/LibCore/File.h +++ b/Libraries/LibCore/File.h @@ -11,10 +11,11 @@ #include #include #include +#include namespace Core { -class File final : public SeekableStream { +class CORE_API File final : public SeekableStream { AK_MAKE_NONCOPYABLE(File); public: diff --git a/Libraries/LibCore/FileWatcher.h b/Libraries/LibCore/FileWatcher.h index 2df8203989..b8a6c5c18b 100644 --- a/Libraries/LibCore/FileWatcher.h +++ b/Libraries/LibCore/FileWatcher.h @@ -14,6 +14,7 @@ #include #include #include +#include #include namespace Core { @@ -42,7 +43,7 @@ enum class FileWatcherFlags : u32 { AK_ENUM_BITWISE_OPERATORS(FileWatcherFlags); -class FileWatcherBase { +class CORE_API FileWatcherBase { public: virtual ~FileWatcherBase() = default; @@ -71,7 +72,7 @@ public: Optional wait_for_event(); }; -class FileWatcher : public FileWatcherBase +class CORE_API FileWatcher : public FileWatcherBase , public RefCounted { AK_MAKE_NONCOPYABLE(FileWatcher); diff --git a/Libraries/LibCore/IOSurface.h b/Libraries/LibCore/IOSurface.h index 9fc7748076..ac41b3f3d9 100644 --- a/Libraries/LibCore/IOSurface.h +++ b/Libraries/LibCore/IOSurface.h @@ -9,11 +9,12 @@ #include #include #include +#include #include namespace Core { -class IOSurfaceHandle { +class CORE_API IOSurfaceHandle { AK_MAKE_NONCOPYABLE(IOSurfaceHandle); public: diff --git a/Libraries/LibCore/LocalServer.h b/Libraries/LibCore/LocalServer.h index 8e0868a02c..3c988562f8 100644 --- a/Libraries/LibCore/LocalServer.h +++ b/Libraries/LibCore/LocalServer.h @@ -7,11 +7,12 @@ #pragma once #include +#include #include namespace Core { -class LocalServer : public EventReceiver { +class CORE_API LocalServer : public EventReceiver { C_OBJECT(LocalServer) public: virtual ~LocalServer() override; diff --git a/Libraries/LibCore/MachPort.h b/Libraries/LibCore/MachPort.h index 373c9affe2..a8f5b63fb3 100644 --- a/Libraries/LibCore/MachPort.h +++ b/Libraries/LibCore/MachPort.h @@ -14,6 +14,7 @@ #include #include +#include #if defined(AK_OS_MACOS) || defined(AK_OS_IOS) # include @@ -26,7 +27,7 @@ extern "C" { namespace Core { // https://www.gnu.org/software/hurd/gnumach-doc/Major-Concepts.html#Major-Concepts -class MachPort { +class CORE_API MachPort { AK_MAKE_NONCOPYABLE(MachPort); public: diff --git a/Libraries/LibCore/MappedFile.h b/Libraries/LibCore/MappedFile.h index 37bc040a84..d0cb7666b6 100644 --- a/Libraries/LibCore/MappedFile.h +++ b/Libraries/LibCore/MappedFile.h @@ -12,11 +12,12 @@ #include #include #include +#include #include namespace Core { -class MappedFile : public FixedMemoryStream { +class CORE_API MappedFile : public FixedMemoryStream { AK_MAKE_NONCOPYABLE(MappedFile); AK_MAKE_NONMOVABLE(MappedFile); diff --git a/Libraries/LibCore/MimeData.h b/Libraries/LibCore/MimeData.h index 36f9b12adc..e4af48f192 100644 --- a/Libraries/LibCore/MimeData.h +++ b/Libraries/LibCore/MimeData.h @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace Core { @@ -48,7 +49,7 @@ private: HashMap m_data; }; -StringView guess_mime_type_based_on_filename(StringView); +CORE_API StringView guess_mime_type_based_on_filename(StringView); Optional guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes); Optional guess_mime_type_based_on_sniffed_bytes(Core::File&); diff --git a/Libraries/LibCore/Notifier.h b/Libraries/LibCore/Notifier.h index bed443d6ec..ab774dd18b 100644 --- a/Libraries/LibCore/Notifier.h +++ b/Libraries/LibCore/Notifier.h @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace Core { @@ -23,7 +24,7 @@ enum class NotificationType : u8 { AK_ENUM_BITWISE_OPERATORS(NotificationType); -class Notifier final : public EventReceiver { +class CORE_API Notifier final : public EventReceiver { C_OBJECT(Notifier); public: diff --git a/Libraries/LibCore/Platform/ProcessStatistics.h b/Libraries/LibCore/Platform/ProcessStatistics.h index ccd51a7313..bd97e004b8 100644 --- a/Libraries/LibCore/Platform/ProcessStatistics.h +++ b/Libraries/LibCore/Platform/ProcessStatistics.h @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace Core::Platform { @@ -26,6 +27,6 @@ struct ProcessStatistics { Vector> processes; }; -ErrorOr update_process_statistics(ProcessStatistics&); +CORE_API ErrorOr update_process_statistics(ProcessStatistics&); } diff --git a/Libraries/LibCore/Platform/ProcessStatisticsMach.h b/Libraries/LibCore/Platform/ProcessStatisticsMach.h index 666a71ebfc..b6c0337be7 100644 --- a/Libraries/LibCore/Platform/ProcessStatisticsMach.h +++ b/Libraries/LibCore/Platform/ProcessStatisticsMach.h @@ -12,11 +12,12 @@ # error "This file is only available on Mach platforms" #endif +#include #include #include namespace Core::Platform { -MachPort register_with_mach_server(ByteString const& server_name); +CORE_API MachPort register_with_mach_server(ByteString const& server_name); } diff --git a/Libraries/LibCore/Process.h b/Libraries/LibCore/Process.h index f3938d21c0..9bc2e75b38 100644 --- a/Libraries/LibCore/Process.h +++ b/Libraries/LibCore/Process.h @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace Core { @@ -46,7 +47,7 @@ struct ProcessSpawnOptions { Vector file_actions {}; }; -class Process { +class CORE_API Process { AK_MAKE_NONCOPYABLE(Process); public: diff --git a/Libraries/LibCore/Resource.h b/Libraries/LibCore/Resource.h index d6cfe6946b..7ab853c488 100644 --- a/Libraries/LibCore/Resource.h +++ b/Libraries/LibCore/Resource.h @@ -14,11 +14,12 @@ #include #include #include +#include #include namespace Core { -class Resource : public RefCounted { +class CORE_API Resource : public RefCounted { public: static ErrorOr> load_from_filesystem(StringView); static ErrorOr> load_from_uri(StringView); diff --git a/Libraries/LibCore/ResourceImplementation.h b/Libraries/LibCore/ResourceImplementation.h index e064a376df..b2a247f3eb 100644 --- a/Libraries/LibCore/ResourceImplementation.h +++ b/Libraries/LibCore/ResourceImplementation.h @@ -8,11 +8,12 @@ #include #include +#include #include namespace Core { -class ResourceImplementation { +class CORE_API ResourceImplementation { public: ErrorOr> load_from_uri(StringView); Vector child_names(Resource const&); diff --git a/Libraries/LibCore/ResourceImplementationFile.h b/Libraries/LibCore/ResourceImplementationFile.h index e3df0510ba..a8bddd85fc 100644 --- a/Libraries/LibCore/ResourceImplementationFile.h +++ b/Libraries/LibCore/ResourceImplementationFile.h @@ -8,12 +8,13 @@ #include #include +#include #include #include namespace Core { -class ResourceImplementationFile : public ResourceImplementation { +class CORE_API ResourceImplementationFile : public ResourceImplementation { public: explicit ResourceImplementationFile(String base_directory); diff --git a/Libraries/LibCore/SharedVersion.h b/Libraries/LibCore/SharedVersion.h index cf064435f7..03ea0ae924 100644 --- a/Libraries/LibCore/SharedVersion.h +++ b/Libraries/LibCore/SharedVersion.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace Core { @@ -18,9 +19,9 @@ using SharedVersionIndex = u32; constexpr inline SharedVersion INVALID_SHARED_VERSION = 0; constexpr inline SharedVersion INITIAL_SHARED_VERSION = 1; -[[nodiscard]] AnonymousBuffer create_shared_version_buffer(); -[[nodiscard]] bool initialize_shared_version(AnonymousBuffer&, SharedVersionIndex); -void increment_shared_version(AnonymousBuffer&, SharedVersionIndex); -Optional get_shared_version(AnonymousBuffer const&, SharedVersionIndex); +[[nodiscard]] CORE_API AnonymousBuffer create_shared_version_buffer(); +[[nodiscard]] CORE_API bool initialize_shared_version(AnonymousBuffer&, SharedVersionIndex); +CORE_API void increment_shared_version(AnonymousBuffer&, SharedVersionIndex); +CORE_API Optional get_shared_version(AnonymousBuffer const&, SharedVersionIndex); } diff --git a/Libraries/LibCore/Socket.h b/Libraries/LibCore/Socket.h index 85e5e2c488..94ae3bce15 100644 --- a/Libraries/LibCore/Socket.h +++ b/Libraries/LibCore/Socket.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -18,7 +19,7 @@ namespace Core { /// The Socket class is the base class for all concrete BSD-style socket /// classes. Sockets are non-seekable streams which can be read byte-wise. -class Socket : public Stream { +class CORE_API Socket : public Stream { public: enum class PreventSIGPIPE { No, @@ -105,7 +106,7 @@ public: virtual ErrorOr reconnect(SocketAddress const&) = 0; }; -class PosixSocketHelper { +class CORE_API PosixSocketHelper { AK_MAKE_NONCOPYABLE(PosixSocketHelper); public: @@ -155,7 +156,7 @@ private: RefPtr m_notifier; }; -class TCPSocket final : public Socket { +class CORE_API TCPSocket final : public Socket { public: static ErrorOr> connect(ByteString const& host, u16 port); static ErrorOr> connect(SocketAddress const& address); @@ -219,7 +220,7 @@ private: PosixSocketHelper m_helper { Badge {} }; }; -class UDPSocket final : public Socket { +class CORE_API UDPSocket final : public Socket { public: static ErrorOr> connect(ByteString const& host, u16 port, Optional timeout = {}); static ErrorOr> connect(SocketAddress const& address, Optional timeout = {}); @@ -280,7 +281,7 @@ private: PosixSocketHelper m_helper { Badge {} }; }; -class LocalSocket final : public Socket { +class CORE_API LocalSocket final : public Socket { public: static ErrorOr> connect(ByteString const& path, PreventSIGPIPE = PreventSIGPIPE::Yes); static ErrorOr> adopt_fd(int fd, PreventSIGPIPE = PreventSIGPIPE::Yes); diff --git a/Libraries/LibCore/SocketAddress.h b/Libraries/LibCore/SocketAddress.h index 98119bb05e..5671a134b8 100644 --- a/Libraries/LibCore/SocketAddress.h +++ b/Libraries/LibCore/SocketAddress.h @@ -9,6 +9,7 @@ #include #include +#include #if defined(AK_OS_WINDOWS) constexpr inline int SOCK_STREAM = 1; @@ -31,7 +32,7 @@ struct sockaddr_un; namespace Core { -class SocketAddress { +class CORE_API SocketAddress { public: enum class Type { Invalid, diff --git a/Libraries/LibCore/StandardPaths.h b/Libraries/LibCore/StandardPaths.h index 30fa4de8c1..571874dad3 100644 --- a/Libraries/LibCore/StandardPaths.h +++ b/Libraries/LibCore/StandardPaths.h @@ -9,10 +9,11 @@ #include #include +#include namespace Core { -class StandardPaths { +class CORE_API StandardPaths { public: static ByteString home_directory(); static ByteString desktop_directory(); diff --git a/Libraries/LibCore/System.h b/Libraries/LibCore/System.h index 7d8b77364f..f0448061b4 100644 --- a/Libraries/LibCore/System.h +++ b/Libraries/LibCore/System.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -66,72 +67,72 @@ ErrorOr accept4(int sockfd, struct sockaddr*, socklen_t*, int flags); ErrorOr sigaction(int signal, struct sigaction const* action, struct sigaction* old_action); #if defined(AK_OS_SOLARIS) -ErrorOr signal(int signal, SIG_TYP handler); +CORE_API ErrorOr signal(int signal, SIG_TYP handler); #elif defined(AK_OS_BSD_GENERIC) -ErrorOr signal(int signal, sig_t handler); +CORE_API ErrorOr signal(int signal, sig_t handler); #else -ErrorOr signal(int signal, sighandler_t handler); +CORE_API ErrorOr signal(int signal, sighandler_t handler); #endif -ErrorOr fstat(int fd); +CORE_API ErrorOr fstat(int fd); ErrorOr fstatat(int fd, StringView path, int flags); -ErrorOr fcntl(int fd, int command, ...); +CORE_API ErrorOr fcntl(int fd, int command, ...); ErrorOr mmap(void* address, size_t, int protection, int flags, int fd, off_t, size_t alignment = 0, StringView name = {}); ErrorOr munmap(void* address, size_t); ErrorOr anon_create(size_t size, int options); -ErrorOr open(StringView path, int options, mode_t mode = 0); +CORE_API ErrorOr open(StringView path, int options, mode_t mode = 0); ErrorOr openat(int fd, StringView path, int options, mode_t mode = 0); -ErrorOr close(int fd); +CORE_API ErrorOr close(int fd); ErrorOr ftruncate(int fd, off_t length); -ErrorOr stat(StringView path); -ErrorOr lstat(StringView path); -ErrorOr read(int fd, Bytes buffer); -ErrorOr write(int fd, ReadonlyBytes buffer); -ErrorOr dup(int source_fd); +CORE_API ErrorOr stat(StringView path); +CORE_API ErrorOr lstat(StringView path); +CORE_API ErrorOr read(int fd, Bytes buffer); +CORE_API ErrorOr write(int fd, ReadonlyBytes buffer); +CORE_API ErrorOr dup(int source_fd); ErrorOr dup2(int source_fd, int destination_fd); -ErrorOr getcwd(); -ErrorOr ioctl(int fd, unsigned request, ...); +CORE_API ErrorOr getcwd(); +CORE_API ErrorOr ioctl(int fd, unsigned request, ...); ErrorOr tcgetattr(int fd); ErrorOr tcsetattr(int fd, int optional_actions, struct termios const&); -ErrorOr chmod(StringView pathname, mode_t mode); +CORE_API ErrorOr chmod(StringView pathname, mode_t mode); ErrorOr lseek(int fd, off_t, int whence); -ErrorOr isatty(int fd); -ErrorOr link(StringView old_path, StringView new_path); -ErrorOr symlink(StringView target, StringView link_path); -ErrorOr mkdir(StringView path, mode_t); -ErrorOr chdir(StringView path); -ErrorOr rmdir(StringView path); -ErrorOr mkstemp(Span pattern); -ErrorOr fchmod(int fd, mode_t mode); -ErrorOr rename(StringView old_path, StringView new_path); -ErrorOr unlink(StringView path); -ErrorOr utimensat(int fd, StringView path, struct timespec const times[2], int flag); -ErrorOr> pipe2(int flags); +CORE_API ErrorOr isatty(int fd); +CORE_API ErrorOr link(StringView old_path, StringView new_path); +CORE_API ErrorOr symlink(StringView target, StringView link_path); +CORE_API ErrorOr mkdir(StringView path, mode_t); +CORE_API ErrorOr chdir(StringView path); +CORE_API ErrorOr rmdir(StringView path); +CORE_API ErrorOr mkstemp(Span pattern); +CORE_API ErrorOr fchmod(int fd, mode_t mode); +CORE_API ErrorOr rename(StringView old_path, StringView new_path); +CORE_API ErrorOr unlink(StringView path); +CORE_API ErrorOr utimensat(int fd, StringView path, struct timespec const times[2], int flag); +CORE_API ErrorOr> pipe2(int flags); -ErrorOr socket(int domain, int type, int protocol); -ErrorOr bind(int sockfd, struct sockaddr const*, socklen_t); -ErrorOr listen(int sockfd, int backlog); +CORE_API ErrorOr socket(int domain, int type, int protocol); +CORE_API ErrorOr bind(int sockfd, struct sockaddr const*, socklen_t); +CORE_API ErrorOr listen(int sockfd, int backlog); ErrorOr accept(int sockfd, struct sockaddr*, socklen_t*); ErrorOr connect(int sockfd, struct sockaddr const*, socklen_t); -ErrorOr send(int sockfd, ReadonlyBytes, int flags); +CORE_API ErrorOr send(int sockfd, ReadonlyBytes, int flags); ErrorOr sendmsg(int sockfd, const struct msghdr*, int flags); ErrorOr sendto(int sockfd, ReadonlyBytes, int flags, struct sockaddr const*, socklen_t); ErrorOr recv(int sockfd, Bytes, int flags); ErrorOr recvmsg(int sockfd, struct msghdr*, int flags); ErrorOr recvfrom(int sockfd, Bytes, int flags, struct sockaddr*, socklen_t*); ErrorOr getsockopt(int sockfd, int level, int option, void* value, socklen_t* value_size); -ErrorOr setsockopt(int sockfd, int level, int option, void const* value, socklen_t value_size); +CORE_API ErrorOr setsockopt(int sockfd, int level, int option, void const* value, socklen_t value_size); ErrorOr getsockname(int sockfd, struct sockaddr*, socklen_t*); ErrorOr getpeername(int sockfd, struct sockaddr*, socklen_t*); -ErrorOr socketpair(int domain, int type, int protocol, int sv[2]); +CORE_API ErrorOr socketpair(int domain, int type, int protocol, int sv[2]); -ErrorOr access(StringView pathname, int mode, int flags = 0); +CORE_API ErrorOr access(StringView pathname, int mode, int flags = 0); ErrorOr readlink(StringView pathname); -ErrorOr poll(Span, int timeout); +CORE_API ErrorOr poll(Span, int timeout); -ErrorOr kill(pid_t, int signal); +CORE_API ErrorOr kill(pid_t, int signal); #if !defined(AK_OS_WINDOWS) -ErrorOr chown(StringView pathname, uid_t uid, gid_t gid); +CORE_API ErrorOr chown(StringView pathname, uid_t uid, gid_t gid); ErrorOr posix_spawn(StringView path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const arguments[], char* const envp[]); ErrorOr posix_spawnp(StringView path, posix_spawn_file_actions_t* const file_actions, posix_spawnattr_t* const attr, char* const arguments[], char* const envp[]); @@ -139,27 +140,27 @@ struct WaitPidResult { pid_t pid; int status; }; -ErrorOr waitpid(pid_t waitee, int options = 0); -ErrorOr fchown(int fd, uid_t, gid_t); +CORE_API ErrorOr waitpid(pid_t waitee, int options = 0); +CORE_API ErrorOr fchown(int fd, uid_t, gid_t); #endif ErrorOr getaddrinfo(char const* nodename, char const* servname, struct addrinfo const& hints); -unsigned hardware_concurrency(); -u64 physical_memory_bytes(); +CORE_API unsigned hardware_concurrency(); +CORE_API u64 physical_memory_bytes(); -ErrorOr current_executable_path(); +CORE_API ErrorOr current_executable_path(); #if !defined(AK_OS_WINDOWS) ErrorOr get_resource_limits(int resource); -ErrorOr set_resource_limits(int resource, rlim_t limit); +CORE_API ErrorOr set_resource_limits(int resource, rlim_t limit); #endif -int getpid(); -bool is_socket(int fd); -ErrorOr sleep_ms(u32 milliseconds); -ErrorOr set_close_on_exec(int fd, bool enabled); +CORE_API int getpid(); +CORE_API bool is_socket(int fd); +CORE_API ErrorOr sleep_ms(u32 milliseconds); +CORE_API ErrorOr set_close_on_exec(int fd, bool enabled); -ErrorOr transfer_file_through_socket(int source_fd, int target_fd, size_t source_offset, size_t source_length); +CORE_API ErrorOr transfer_file_through_socket(int source_fd, int target_fd, size_t source_offset, size_t source_length); } diff --git a/Libraries/LibCore/SystemServerTakeover.h b/Libraries/LibCore/SystemServerTakeover.h index 0a1bdae038..59b1ed98b6 100644 --- a/Libraries/LibCore/SystemServerTakeover.h +++ b/Libraries/LibCore/SystemServerTakeover.h @@ -6,10 +6,11 @@ #pragma once +#include #include namespace Core { -ErrorOr> take_over_socket_from_system_server(ByteString const& socket_path = {}); +CORE_API ErrorOr> take_over_socket_from_system_server(ByteString const& socket_path = {}); } diff --git a/Libraries/LibCore/TCPServer.h b/Libraries/LibCore/TCPServer.h index 76db65cca3..1e003fe6f2 100644 --- a/Libraries/LibCore/TCPServer.h +++ b/Libraries/LibCore/TCPServer.h @@ -9,11 +9,12 @@ #include #include +#include #include namespace Core { -class TCPServer : public EventReceiver { +class CORE_API TCPServer : public EventReceiver { C_OBJECT_ABSTRACT(TCPServer) public: static ErrorOr> try_create(); diff --git a/Libraries/LibCore/ThreadEventQueue.h b/Libraries/LibCore/ThreadEventQueue.h index 97caa71ff0..db67c4eb8f 100644 --- a/Libraries/LibCore/ThreadEventQueue.h +++ b/Libraries/LibCore/ThreadEventQueue.h @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace Core { @@ -16,7 +17,7 @@ namespace Core { // Per-thread global event queue. This is where events are queued for the EventLoop to process. // There is only one ThreadEventQueue per thread, and it is accessed via ThreadEventQueue::current(). // It is allowed to post events to other threads' event queues. -class ThreadEventQueue { +class CORE_API ThreadEventQueue { AK_MAKE_NONCOPYABLE(ThreadEventQueue); AK_MAKE_NONMOVABLE(ThreadEventQueue); diff --git a/Libraries/LibCore/TimeZoneWatcher.h b/Libraries/LibCore/TimeZoneWatcher.h index 572af98bc4..5bebfdb8ab 100644 --- a/Libraries/LibCore/TimeZoneWatcher.h +++ b/Libraries/LibCore/TimeZoneWatcher.h @@ -10,10 +10,11 @@ #include #include #include +#include namespace Core { -class TimeZoneWatcher { +class CORE_API TimeZoneWatcher { AK_MAKE_NONCOPYABLE(TimeZoneWatcher); public: diff --git a/Libraries/LibCore/Timer.h b/Libraries/LibCore/Timer.h index 6fe9fe40e3..9d6cd3faec 100644 --- a/Libraries/LibCore/Timer.h +++ b/Libraries/LibCore/Timer.h @@ -9,10 +9,11 @@ #include #include +#include namespace Core { -class Timer final : public EventReceiver { +class CORE_API Timer final : public EventReceiver { C_OBJECT(Timer); public: diff --git a/Libraries/LibCore/UDPServer.h b/Libraries/LibCore/UDPServer.h index 56cadb6fc2..7ab485c873 100644 --- a/Libraries/LibCore/UDPServer.h +++ b/Libraries/LibCore/UDPServer.h @@ -11,12 +11,13 @@ #include #include #include +#include #include #include namespace Core { -class UDPServer : public EventReceiver { +class CORE_API UDPServer : public EventReceiver { C_OBJECT(UDPServer) public: virtual ~UDPServer() override; diff --git a/Libraries/LibCore/Version.h b/Libraries/LibCore/Version.h index 22a5c174f2..22d0b69cad 100644 --- a/Libraries/LibCore/Version.h +++ b/Libraries/LibCore/Version.h @@ -8,9 +8,10 @@ #pragma once #include +#include namespace Core::Version { -String read_long_version_string(); +CORE_API String read_long_version_string(); } diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index a568fc37bf..917a11109c 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -195,6 +195,12 @@ install(TARGETS NoCoverage EXPORT LagomTargets) # AK add_ladybird_subdirectory(AK) +# LibCore dependencies +add_ladybird_subdirectory(Libraries/LibTextCodec) +add_ladybird_subdirectory(Libraries/LibUnicode) +add_ladybird_subdirectory(Libraries/LibRegex) +add_ladybird_subdirectory(Libraries/LibURL) + # LibCore add_ladybird_subdirectory(Libraries/LibCore)