[Libguestfs] [PATCH v2 2/7] lib: Force visibility default on public actions.

Richard W.M. Jones rjones at redhat.com
Tue Oct 30 11:57:10 UTC 2012


From: "Richard W.M. Jones" <rjones at redhat.com>

This is currently done implicitly because of the linker script.
However in order to do symbol versioning, we will have to do
this explicitly at each definition instead.
---
 generator/c.ml | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/generator/c.ml b/generator/c.ml
index 484b4f9..798a3a3 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -711,7 +711,7 @@ and generate_client_free_structs () =
 
   List.iter (
     fun (typ, _) ->
-      pr "void\n";
+      pr "GUESTFS_DLL_PUBLIC void\n";
       pr "guestfs_free_%s (struct guestfs_%s *x)\n" typ typ;
       pr "{\n";
       pr "  xdr_free ((xdrproc_t) xdr_guestfs_int_%s, (char *) x);\n" typ;
@@ -719,7 +719,7 @@ and generate_client_free_structs () =
       pr "}\n";
       pr "\n";
 
-      pr "void\n";
+      pr "GUESTFS_DLL_PUBLIC void\n";
       pr "guestfs_free_%s_list (struct guestfs_%s_list *x)\n" typ typ;
       pr "{\n";
       pr "  xdr_free ((xdrproc_t) xdr_guestfs_int_%s_list, (char *) x);\n" typ;
@@ -1115,10 +1115,12 @@ trace_send_line (guestfs_h *g)
     if optargs = [] then
       generate_prototype ~extern:false ~semicolon:false ~newline:true
         ~handle:"g" ~prefix:"guestfs_"
+        ~dll_public:true
         c_name style
     else
       generate_prototype ~extern:false ~semicolon:false ~newline:true
         ~handle:"g" ~prefix:"guestfs_" ~suffix:"_argv" ~optarg_proto:Argv
+        ~dll_public:true
         c_name style;
     pr "{\n";
 
@@ -1191,11 +1193,15 @@ trace_send_line (guestfs_h *g)
     (* Generate the action stub. *)
     if optargs = [] then
       generate_prototype ~extern:false ~semicolon:false ~newline:true
-        ~handle:"g" ~prefix:"guestfs_" c_name style
+        ~handle:"g" ~prefix:"guestfs_"
+        ~dll_public:true
+        c_name style
     else
       generate_prototype ~extern:false ~semicolon:false ~newline:true
         ~handle:"g" ~prefix:"guestfs_" ~suffix:"_argv"
-        ~optarg_proto:Argv c_name style;
+        ~optarg_proto:Argv
+        ~dll_public:true
+        c_name style;
 
     pr "{\n";
 
-- 
1.7.11.4




More information about the Libguestfs mailing list