[libvirt] [ocaml PATCH 7/6] Hide again the internal helpers

Pino Toscano posted 6 patches 6 years, 5 months ago
[libvirt] [ocaml PATCH 7/6] Hide again the internal helpers
Posted by Pino Toscano 6 years, 5 months ago
Use a GCC pragma to hide all the internal helpers, so they are not
exposed as public symbols of the stub library.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
---
 libvirt/libvirt_c.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libvirt/libvirt_c.h b/libvirt/libvirt_c.h
index 541d8e3..45937f6 100644
--- a/libvirt/libvirt_c.h
+++ b/libvirt/libvirt_c.h
@@ -40,6 +40,13 @@
 
 /* Please read libvirt/README file. */
 
+/* Make sure to not expose our internal helpers as public symbols.
+ * https://gcc.gnu.org/wiki/Visibility
+ */
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
 const char *Optstring_val (value strv);
 typedef value (*Val_ptr_t) (void *);
 value Val_opt (void *ptr, Val_ptr_t Val_ptr);
@@ -153,4 +160,8 @@ value Val_pool (virStoragePoolPtr pol, value connv);
 value Val_volume (virStorageVolPtr vol, value connv);
 value Val_secret (virSecretPtr sec, value connv);
 
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
 #endif
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [ocaml PATCH 7/6] Hide again the internal helpers
Posted by Richard W.M. Jones 6 years, 5 months ago
On Tue, Sep 03, 2019 at 01:41:16PM +0200, Pino Toscano wrote:
> Use a GCC pragma to hide all the internal helpers, so they are not
> exposed as public symbols of the stub library.
> 
> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
> ---
>  libvirt/libvirt_c.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/libvirt/libvirt_c.h b/libvirt/libvirt_c.h
> index 541d8e3..45937f6 100644
> --- a/libvirt/libvirt_c.h
> +++ b/libvirt/libvirt_c.h
> @@ -40,6 +40,13 @@
>  
>  /* Please read libvirt/README file. */
>  
> +/* Make sure to not expose our internal helpers as public symbols.
> + * https://gcc.gnu.org/wiki/Visibility
> + */
> +#ifdef __GNUC__
> +#pragma GCC visibility push(hidden)
> +#endif
> +
>  const char *Optstring_val (value strv);
>  typedef value (*Val_ptr_t) (void *);
>  value Val_opt (void *ptr, Val_ptr_t Val_ptr);
> @@ -153,4 +160,8 @@ value Val_pool (virStoragePoolPtr pol, value connv);
>  value Val_volume (virStorageVolPtr vol, value connv);
>  value Val_secret (virSecretPtr sec, value connv);
>  
> +#ifdef __GNUC__
> +#pragma GCC visibility pop
> +#endif
> +
>  #endif

Even better :-)

ACK series.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list