LibCore: Explicitly export symbols from LibCore

This patch adds explicit symbol export to LibCore. This leads to about
350 less symbols being exported.
This commit is contained in:
R-Goc 2025-12-04 18:12:06 +01:00 committed by Shannon Booth
parent 57b12d3ca0
commit 919f44f3a5
39 changed files with 143 additions and 104 deletions

View file

@ -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)

View file

@ -11,10 +11,12 @@
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/Types.h>
#include <LibCore/Export.h>
namespace Core {
class AnonymousBufferImpl final : public RefCounted<AnonymousBufferImpl> {
// TODO: Hide the implementation from ABI
class CORE_API AnonymousBufferImpl final : public RefCounted<AnonymousBufferImpl> {
public:
static ErrorOr<NonnullRefPtr<AnonymousBufferImpl>> create(size_t);
static ErrorOr<NonnullRefPtr<AnonymousBufferImpl>> create(int fd, size_t);
@ -33,7 +35,7 @@ private:
void* m_data { nullptr };
};
class AnonymousBuffer {
class CORE_API AnonymousBuffer {
public:
static ErrorOr<AnonymousBuffer> create_with_size(size_t);
static ErrorOr<AnonymousBuffer> create_from_anon_fd(int fd, size_t);

View file

@ -10,12 +10,13 @@
#include <AK/Concepts.h>
#include <AK/Function.h>
#include <AK/Vector.h>
#include <LibCore/Export.h>
#include <LibMain/Main.h>
#include <stdio.h>
namespace Core {
class ArgsParser {
class CORE_API ArgsParser {
public:
ArgsParser();

View file

@ -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

View file

@ -15,11 +15,12 @@
#include <AK/OwnPtr.h>
#include <AK/RefCounted.h>
#include <AK/Vector.h>
#include <LibCore/Export.h>
#include <LibCore/File.h>
namespace Core {
class ConfigFile : public RefCounted<ConfigFile> {
class CORE_API ConfigFile : public RefCounted<ConfigFile> {
public:
enum class AllowWriting {
Yes,

View file

@ -8,10 +8,11 @@
#pragma once
#include <LibCore/DirectoryEntry.h>
#include <LibCore/Export.h>
namespace Core {
class DirIterator {
class CORE_API DirIterator {
public:
enum Flags {
NoFlags = 0x0,

View file

@ -14,13 +14,14 @@
#include <AK/Noncopyable.h>
#include <LibCore/DirIterator.h>
#include <LibCore/DirectoryEntry.h>
#include <LibCore/Export.h>
#include <LibCore/File.h>
#include <sys/stat.h>
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:

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/Time.h>
#include <LibCore/Export.h>
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);

View file

@ -9,6 +9,7 @@
#include <AK/Error.h>
#include <AK/Optional.h>
#include <AK/StringView.h>
#include <LibCore/Export.h>
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<StringView> get(StringView name, SecureOnly = SecureOnly::No);
CORE_API Optional<StringView> get(StringView name, SecureOnly = SecureOnly::No);
enum class Overwrite {
No,
Yes,
};
ErrorOr<void> set(StringView name, StringView value, Overwrite);
CORE_API ErrorOr<void> set(StringView name, StringView value, Overwrite);
ErrorOr<void> unset(StringView name);
ErrorOr<void> put(StringView env);

View file

@ -15,6 +15,7 @@
#include <AK/NonnullOwnPtr.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefPtr.h>
#include <LibCore/Export.h>
#include <LibCore/Forward.h>
#include <LibThreading/RWLock.h>
@ -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<WeakEventLoopReference> {
class CORE_API WeakEventLoopReference : public AtomicRefCounted<WeakEventLoopReference> {
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<void()>);
CORE_API void deferred_invoke(ESCAPING Function<void()>);
}

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/Function.h>
#include <LibCore/Export.h>
#include <LibCore/Forward.h>
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();

View file

@ -12,6 +12,7 @@
#include <AK/Noncopyable.h>
#include <AK/StringView.h>
#include <AK/Weakable.h>
#include <LibCore/Export.h>
#include <LibCore/Forward.h>
namespace Core {
@ -35,7 +36,7 @@ public: \
return #klass##sv; \
}
class EventReceiver
class CORE_API EventReceiver
: public AtomicRefCounted<EventReceiver>
, public Weakable<EventReceiver> {
// NOTE: No C_OBJECT macro for Core::EventReceiver itself.

View file

@ -11,10 +11,11 @@
#include <AK/Noncopyable.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/Stream.h>
#include <LibCore/Export.h>
namespace Core {
class File final : public SeekableStream {
class CORE_API File final : public SeekableStream {
AK_MAKE_NONCOPYABLE(File);
public:

View file

@ -14,6 +14,7 @@
#include <AK/Noncopyable.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <LibCore/Export.h>
#include <LibCore/Notifier.h>
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<FileWatcherEvent> wait_for_event();
};
class FileWatcher : public FileWatcherBase
class CORE_API FileWatcher : public FileWatcherBase
, public RefCounted<FileWatcher> {
AK_MAKE_NONCOPYABLE(FileWatcher);

View file

@ -9,11 +9,12 @@
#include <AK/Forward.h>
#include <AK/Noncopyable.h>
#include <AK/OwnPtr.h>
#include <LibCore/Export.h>
#include <LibCore/MachPort.h>
namespace Core {
class IOSurfaceHandle {
class CORE_API IOSurfaceHandle {
AK_MAKE_NONCOPYABLE(IOSurfaceHandle);
public:

View file

@ -7,11 +7,12 @@
#pragma once
#include <LibCore/EventReceiver.h>
#include <LibCore/Export.h>
#include <LibCore/Notifier.h>
namespace Core {
class LocalServer : public EventReceiver {
class CORE_API LocalServer : public EventReceiver {
C_OBJECT(LocalServer)
public:
virtual ~LocalServer() override;

View file

@ -14,6 +14,7 @@
#include <AK/Error.h>
#include <AK/Noncopyable.h>
#include <LibCore/Export.h>
#if defined(AK_OS_MACOS) || defined(AK_OS_IOS)
# include <mach/mach.h>
@ -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:

View file

@ -12,11 +12,12 @@
#include <AK/Noncopyable.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/RefCounted.h>
#include <LibCore/Export.h>
#include <LibCore/Forward.h>
namespace Core {
class MappedFile : public FixedMemoryStream {
class CORE_API MappedFile : public FixedMemoryStream {
AK_MAKE_NONCOPYABLE(MappedFile);
AK_MAKE_NONMOVABLE(MappedFile);

View file

@ -10,6 +10,7 @@
#include <AK/ByteBuffer.h>
#include <AK/HashMap.h>
#include <LibCore/EventReceiver.h>
#include <LibCore/Export.h>
#include <LibURL/URL.h>
namespace Core {
@ -48,7 +49,7 @@ private:
HashMap<String, ByteBuffer> m_data;
};
StringView guess_mime_type_based_on_filename(StringView);
CORE_API StringView guess_mime_type_based_on_filename(StringView);
Optional<StringView> guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes);
Optional<StringView> guess_mime_type_based_on_sniffed_bytes(Core::File&);

View file

@ -9,6 +9,7 @@
#include <AK/Function.h>
#include <LibCore/Event.h>
#include <LibCore/EventReceiver.h>
#include <LibCore/Export.h>
#include <pthread.h>
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:

View file

@ -10,6 +10,7 @@
#include <AK/NonnullOwnPtr.h>
#include <AK/TypeCasts.h>
#include <AK/Vector.h>
#include <LibCore/Export.h>
#include <LibCore/Platform/ProcessInfo.h>
namespace Core::Platform {
@ -26,6 +27,6 @@ struct ProcessStatistics {
Vector<NonnullOwnPtr<ProcessInfo>> processes;
};
ErrorOr<void> update_process_statistics(ProcessStatistics&);
CORE_API ErrorOr<void> update_process_statistics(ProcessStatistics&);
}

View file

@ -12,11 +12,12 @@
# error "This file is only available on Mach platforms"
#endif
#include <LibCore/Export.h>
#include <LibCore/Platform/ProcessStatistics.h>
#include <mach/mach.h>
namespace Core::Platform {
MachPort register_with_mach_server(ByteString const& server_name);
CORE_API MachPort register_with_mach_server(ByteString const& server_name);
}

View file

@ -12,6 +12,7 @@
#include <AK/ByteString.h>
#include <AK/Forward.h>
#include <AK/String.h>
#include <LibCore/Export.h>
#include <LibCore/File.h>
namespace Core {
@ -46,7 +47,7 @@ struct ProcessSpawnOptions {
Vector<FileActionType> file_actions {};
};
class Process {
class CORE_API Process {
AK_MAKE_NONCOPYABLE(Process);
public:

View file

@ -14,11 +14,12 @@
#include <AK/String.h>
#include <AK/StringView.h>
#include <AK/Variant.h>
#include <LibCore/Export.h>
#include <LibCore/MappedFile.h>
namespace Core {
class Resource : public RefCounted<Resource> {
class CORE_API Resource : public RefCounted<Resource> {
public:
static ErrorOr<NonnullRefPtr<Resource>> load_from_filesystem(StringView);
static ErrorOr<NonnullRefPtr<Resource>> load_from_uri(StringView);

View file

@ -8,11 +8,12 @@
#include <AK/NonnullRefPtr.h>
#include <AK/StringView.h>
#include <LibCore/Export.h>
#include <LibCore/Resource.h>
namespace Core {
class ResourceImplementation {
class CORE_API ResourceImplementation {
public:
ErrorOr<NonnullRefPtr<Resource>> load_from_uri(StringView);
Vector<String> child_names(Resource const&);

View file

@ -8,12 +8,13 @@
#include <AK/NonnullRefPtr.h>
#include <AK/StringView.h>
#include <LibCore/Export.h>
#include <LibCore/Resource.h>
#include <LibCore/ResourceImplementation.h>
namespace Core {
class ResourceImplementationFile : public ResourceImplementation {
class CORE_API ResourceImplementationFile : public ResourceImplementation {
public:
explicit ResourceImplementationFile(String base_directory);

View file

@ -9,6 +9,7 @@
#include <AK/Optional.h>
#include <AK/Types.h>
#include <LibCore/AnonymousBuffer.h>
#include <LibCore/Export.h>
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<SharedVersion> 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<SharedVersion> get_shared_version(AnonymousBuffer const&, SharedVersionIndex);
}

View file

@ -11,6 +11,7 @@
#include <AK/Function.h>
#include <AK/Stream.h>
#include <AK/Time.h>
#include <LibCore/Export.h>
#include <LibCore/Notifier.h>
#include <LibCore/SocketAddress.h>
@ -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<void> reconnect(SocketAddress const&) = 0;
};
class PosixSocketHelper {
class CORE_API PosixSocketHelper {
AK_MAKE_NONCOPYABLE(PosixSocketHelper);
public:
@ -155,7 +156,7 @@ private:
RefPtr<Core::Notifier> m_notifier;
};
class TCPSocket final : public Socket {
class CORE_API TCPSocket final : public Socket {
public:
static ErrorOr<NonnullOwnPtr<TCPSocket>> connect(ByteString const& host, u16 port);
static ErrorOr<NonnullOwnPtr<TCPSocket>> connect(SocketAddress const& address);
@ -219,7 +220,7 @@ private:
PosixSocketHelper m_helper { Badge<TCPSocket> {} };
};
class UDPSocket final : public Socket {
class CORE_API UDPSocket final : public Socket {
public:
static ErrorOr<NonnullOwnPtr<UDPSocket>> connect(ByteString const& host, u16 port, Optional<AK::Duration> timeout = {});
static ErrorOr<NonnullOwnPtr<UDPSocket>> connect(SocketAddress const& address, Optional<AK::Duration> timeout = {});
@ -280,7 +281,7 @@ private:
PosixSocketHelper m_helper { Badge<UDPSocket> {} };
};
class LocalSocket final : public Socket {
class CORE_API LocalSocket final : public Socket {
public:
static ErrorOr<NonnullOwnPtr<LocalSocket>> connect(ByteString const& path, PreventSIGPIPE = PreventSIGPIPE::Yes);
static ErrorOr<NonnullOwnPtr<LocalSocket>> adopt_fd(int fd, PreventSIGPIPE = PreventSIGPIPE::Yes);

View file

@ -9,6 +9,7 @@
#include <AK/IPv4Address.h>
#include <AK/IPv6Address.h>
#include <LibCore/Export.h>
#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,

View file

@ -9,10 +9,11 @@
#include <AK/Error.h>
#include <AK/Forward.h>
#include <LibCore/Export.h>
namespace Core {
class StandardPaths {
class CORE_API StandardPaths {
public:
static ByteString home_directory();
static ByteString desktop_directory();

View file

@ -11,6 +11,7 @@
#include <AK/Error.h>
#include <AK/StringView.h>
#include <LibCore/AddressInfoVector.h>
#include <LibCore/Export.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/stat.h>
@ -66,72 +67,72 @@ ErrorOr<int> accept4(int sockfd, struct sockaddr*, socklen_t*, int flags);
ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigaction* old_action);
#if defined(AK_OS_SOLARIS)
ErrorOr<SIG_TYP> signal(int signal, SIG_TYP handler);
CORE_API ErrorOr<SIG_TYP> signal(int signal, SIG_TYP handler);
#elif defined(AK_OS_BSD_GENERIC)
ErrorOr<sig_t> signal(int signal, sig_t handler);
CORE_API ErrorOr<sig_t> signal(int signal, sig_t handler);
#else
ErrorOr<sighandler_t> signal(int signal, sighandler_t handler);
CORE_API ErrorOr<sighandler_t> signal(int signal, sighandler_t handler);
#endif
ErrorOr<struct stat> fstat(int fd);
CORE_API ErrorOr<struct stat> fstat(int fd);
ErrorOr<struct stat> fstatat(int fd, StringView path, int flags);
ErrorOr<int> fcntl(int fd, int command, ...);
CORE_API ErrorOr<int> fcntl(int fd, int command, ...);
ErrorOr<void*> mmap(void* address, size_t, int protection, int flags, int fd, off_t, size_t alignment = 0, StringView name = {});
ErrorOr<void> munmap(void* address, size_t);
ErrorOr<int> anon_create(size_t size, int options);
ErrorOr<int> open(StringView path, int options, mode_t mode = 0);
CORE_API ErrorOr<int> open(StringView path, int options, mode_t mode = 0);
ErrorOr<int> openat(int fd, StringView path, int options, mode_t mode = 0);
ErrorOr<void> close(int fd);
CORE_API ErrorOr<void> close(int fd);
ErrorOr<void> ftruncate(int fd, off_t length);
ErrorOr<struct stat> stat(StringView path);
ErrorOr<struct stat> lstat(StringView path);
ErrorOr<size_t> read(int fd, Bytes buffer);
ErrorOr<size_t> write(int fd, ReadonlyBytes buffer);
ErrorOr<int> dup(int source_fd);
CORE_API ErrorOr<struct stat> stat(StringView path);
CORE_API ErrorOr<struct stat> lstat(StringView path);
CORE_API ErrorOr<size_t> read(int fd, Bytes buffer);
CORE_API ErrorOr<size_t> write(int fd, ReadonlyBytes buffer);
CORE_API ErrorOr<int> dup(int source_fd);
ErrorOr<int> dup2(int source_fd, int destination_fd);
ErrorOr<ByteString> getcwd();
ErrorOr<void> ioctl(int fd, unsigned request, ...);
CORE_API ErrorOr<ByteString> getcwd();
CORE_API ErrorOr<void> ioctl(int fd, unsigned request, ...);
ErrorOr<struct termios> tcgetattr(int fd);
ErrorOr<void> tcsetattr(int fd, int optional_actions, struct termios const&);
ErrorOr<void> chmod(StringView pathname, mode_t mode);
CORE_API ErrorOr<void> chmod(StringView pathname, mode_t mode);
ErrorOr<off_t> lseek(int fd, off_t, int whence);
ErrorOr<bool> isatty(int fd);
ErrorOr<void> link(StringView old_path, StringView new_path);
ErrorOr<void> symlink(StringView target, StringView link_path);
ErrorOr<void> mkdir(StringView path, mode_t);
ErrorOr<void> chdir(StringView path);
ErrorOr<void> rmdir(StringView path);
ErrorOr<int> mkstemp(Span<char> pattern);
ErrorOr<void> fchmod(int fd, mode_t mode);
ErrorOr<void> rename(StringView old_path, StringView new_path);
ErrorOr<void> unlink(StringView path);
ErrorOr<void> utimensat(int fd, StringView path, struct timespec const times[2], int flag);
ErrorOr<Array<int, 2>> pipe2(int flags);
CORE_API ErrorOr<bool> isatty(int fd);
CORE_API ErrorOr<void> link(StringView old_path, StringView new_path);
CORE_API ErrorOr<void> symlink(StringView target, StringView link_path);
CORE_API ErrorOr<void> mkdir(StringView path, mode_t);
CORE_API ErrorOr<void> chdir(StringView path);
CORE_API ErrorOr<void> rmdir(StringView path);
CORE_API ErrorOr<int> mkstemp(Span<char> pattern);
CORE_API ErrorOr<void> fchmod(int fd, mode_t mode);
CORE_API ErrorOr<void> rename(StringView old_path, StringView new_path);
CORE_API ErrorOr<void> unlink(StringView path);
CORE_API ErrorOr<void> utimensat(int fd, StringView path, struct timespec const times[2], int flag);
CORE_API ErrorOr<Array<int, 2>> pipe2(int flags);
ErrorOr<int> socket(int domain, int type, int protocol);
ErrorOr<void> bind(int sockfd, struct sockaddr const*, socklen_t);
ErrorOr<void> listen(int sockfd, int backlog);
CORE_API ErrorOr<int> socket(int domain, int type, int protocol);
CORE_API ErrorOr<void> bind(int sockfd, struct sockaddr const*, socklen_t);
CORE_API ErrorOr<void> listen(int sockfd, int backlog);
ErrorOr<int> accept(int sockfd, struct sockaddr*, socklen_t*);
ErrorOr<void> connect(int sockfd, struct sockaddr const*, socklen_t);
ErrorOr<size_t> send(int sockfd, ReadonlyBytes, int flags);
CORE_API ErrorOr<size_t> send(int sockfd, ReadonlyBytes, int flags);
ErrorOr<size_t> sendmsg(int sockfd, const struct msghdr*, int flags);
ErrorOr<size_t> sendto(int sockfd, ReadonlyBytes, int flags, struct sockaddr const*, socklen_t);
ErrorOr<size_t> recv(int sockfd, Bytes, int flags);
ErrorOr<size_t> recvmsg(int sockfd, struct msghdr*, int flags);
ErrorOr<size_t> recvfrom(int sockfd, Bytes, int flags, struct sockaddr*, socklen_t*);
ErrorOr<void> getsockopt(int sockfd, int level, int option, void* value, socklen_t* value_size);
ErrorOr<void> setsockopt(int sockfd, int level, int option, void const* value, socklen_t value_size);
CORE_API ErrorOr<void> setsockopt(int sockfd, int level, int option, void const* value, socklen_t value_size);
ErrorOr<void> getsockname(int sockfd, struct sockaddr*, socklen_t*);
ErrorOr<void> getpeername(int sockfd, struct sockaddr*, socklen_t*);
ErrorOr<void> socketpair(int domain, int type, int protocol, int sv[2]);
CORE_API ErrorOr<void> socketpair(int domain, int type, int protocol, int sv[2]);
ErrorOr<void> access(StringView pathname, int mode, int flags = 0);
CORE_API ErrorOr<void> access(StringView pathname, int mode, int flags = 0);
ErrorOr<ByteString> readlink(StringView pathname);
ErrorOr<int> poll(Span<struct pollfd>, int timeout);
CORE_API ErrorOr<int> poll(Span<struct pollfd>, int timeout);
ErrorOr<void> kill(pid_t, int signal);
CORE_API ErrorOr<void> kill(pid_t, int signal);
#if !defined(AK_OS_WINDOWS)
ErrorOr<void> chown(StringView pathname, uid_t uid, gid_t gid);
CORE_API ErrorOr<void> chown(StringView pathname, uid_t uid, gid_t gid);
ErrorOr<pid_t> posix_spawn(StringView path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const arguments[], char* const envp[]);
ErrorOr<pid_t> 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<WaitPidResult> waitpid(pid_t waitee, int options = 0);
ErrorOr<void> fchown(int fd, uid_t, gid_t);
CORE_API ErrorOr<WaitPidResult> waitpid(pid_t waitee, int options = 0);
CORE_API ErrorOr<void> fchown(int fd, uid_t, gid_t);
#endif
ErrorOr<AddressInfoVector> 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<ByteString> current_executable_path();
CORE_API ErrorOr<ByteString> current_executable_path();
#if !defined(AK_OS_WINDOWS)
ErrorOr<rlimit> get_resource_limits(int resource);
ErrorOr<void> set_resource_limits(int resource, rlim_t limit);
CORE_API ErrorOr<void> set_resource_limits(int resource, rlim_t limit);
#endif
int getpid();
bool is_socket(int fd);
ErrorOr<void> sleep_ms(u32 milliseconds);
ErrorOr<void> set_close_on_exec(int fd, bool enabled);
CORE_API int getpid();
CORE_API bool is_socket(int fd);
CORE_API ErrorOr<void> sleep_ms(u32 milliseconds);
CORE_API ErrorOr<void> set_close_on_exec(int fd, bool enabled);
ErrorOr<size_t> transfer_file_through_socket(int source_fd, int target_fd, size_t source_offset, size_t source_length);
CORE_API ErrorOr<size_t> transfer_file_through_socket(int source_fd, int target_fd, size_t source_offset, size_t source_length);
}

View file

@ -6,10 +6,11 @@
#pragma once
#include <LibCore/Export.h>
#include <LibCore/Socket.h>
namespace Core {
ErrorOr<NonnullOwnPtr<Core::LocalSocket>> take_over_socket_from_system_server(ByteString const& socket_path = {});
CORE_API ErrorOr<NonnullOwnPtr<Core::LocalSocket>> take_over_socket_from_system_server(ByteString const& socket_path = {});
}

View file

@ -9,11 +9,12 @@
#include <AK/IPv4Address.h>
#include <LibCore/EventReceiver.h>
#include <LibCore/Export.h>
#include <LibCore/Notifier.h>
namespace Core {
class TCPServer : public EventReceiver {
class CORE_API TCPServer : public EventReceiver {
C_OBJECT_ABSTRACT(TCPServer)
public:
static ErrorOr<NonnullRefPtr<TCPServer>> try_create();

View file

@ -9,6 +9,7 @@
#include <AK/NonnullRefPtr.h>
#include <AK/OwnPtr.h>
#include <LibCore/Event.h>
#include <LibCore/Export.h>
#include <LibCore/Forward.h>
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);

View file

@ -10,10 +10,11 @@
#include <AK/Function.h>
#include <AK/Noncopyable.h>
#include <AK/NonnullOwnPtr.h>
#include <LibCore/Export.h>
namespace Core {
class TimeZoneWatcher {
class CORE_API TimeZoneWatcher {
AK_MAKE_NONCOPYABLE(TimeZoneWatcher);
public:

View file

@ -9,10 +9,11 @@
#include <AK/Function.h>
#include <LibCore/EventReceiver.h>
#include <LibCore/Export.h>
namespace Core {
class Timer final : public EventReceiver {
class CORE_API Timer final : public EventReceiver {
C_OBJECT(Timer);
public:

View file

@ -11,12 +11,13 @@
#include <AK/Forward.h>
#include <AK/Function.h>
#include <LibCore/EventReceiver.h>
#include <LibCore/Export.h>
#include <LibCore/Forward.h>
#include <LibCore/SocketAddress.h>
namespace Core {
class UDPServer : public EventReceiver {
class CORE_API UDPServer : public EventReceiver {
C_OBJECT(UDPServer)
public:
virtual ~UDPServer() override;

View file

@ -8,9 +8,10 @@
#pragma once
#include <AK/Forward.h>
#include <LibCore/Export.h>
namespace Core::Version {
String read_long_version_string();
CORE_API String read_long_version_string();
}

View file

@ -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)