mhn2
mhn2

Reputation: 129

What is the proper way of defining visibility macros in Meson?

I'm developing a cross-platform library for Linux and Windows, which should be built and linked as a shared library. (But I want to allow building and linking as static library as well.)

I'm trying to follow this guide (more specifically the "Step-by-step guide" section). But it requires a macro like FOX_DLL that is defined when the library is built and linked as a shared library, and a macro like FOX_DLL_EXPORTS that is defined when the library is only being built as a shared library.

I have some ideas on how to achieve this with Meson, but I'm not sure if I'm doing it correctly or if there is a better way to do it.

I know that the solution most likely revolves around library() <lang>_shared_args, declare_dependency() compile_args/link_args, add_project_arguments and get_option('default_library'). But I'm really confused, and I'm not sure which macros should be defined with which methods.

How should I define those macros? Should I follow other solutions for defining visibility macros, instead of the one mentioned in that guide?

Upvotes: 0

Views: 48

Answers (0)

Related Questions