diff --git a/binaryc/custom_logging.c b/binaryc/custom_logging.c
index 22c19e939fd0fe56509d91802c583b724cd40b20..e25c5fbb127048a37739edfce27993cec54b8175 100644
--- a/binaryc/custom_logging.c
+++ b/binaryc/custom_logging.c
@@ -8,10 +8,8 @@ void custom_output_function(struct stardata_t * stardata);
 void custom_output_function(struct stardata_t * stardata)
 {
     // struct stardata_t * stardata = (struct stardata_t *)x;
-    PRINTF("MY_STELLAR_DATA %g %g
-",((double)stardata->model.time),((double)stardata->star[0].mass));
-PRINTF("my_sss2 %g %g
-",((double)stardata->model.time),((double)stardata->star[1].mass));;
+    PRINTF("MY_STELLAR_DATA %g %g\n",((double)stardata->model.time),((double)stardata->star[0].mass));
+PRINTF("my_sss2 %g %g\n",((double)stardata->model.time),((double)stardata->star[1].mass));;
 }
 
 #undef MAX 
diff --git a/binaryc/functions.py b/binaryc/functions.py
index b9d635e071213b9a8d47eaedb5291477721d2115..207f7576e00b75b640334d5fbd92a663e8e6bee0 100644
--- a/binaryc/functions.py
+++ b/binaryc/functions.py
@@ -39,7 +39,7 @@ def autogen_C_logging_code(logging_dict):
             code += 'PRINTF("{}'.format(key)
             code += ' {}'.format('%g '*len(logging_dict_entry))
             code = code.strip()
-            code += '\n"'
+            code += '\\n"'
 
             # Add format keys
             for param in logging_dict_entry:
@@ -118,7 +118,9 @@ def return_compilation_dict():
     inspired by binary_c_inline_config command in perl
 
     TODO: this function still has some cleaning up to do wrt default values for the compile command
-    
+    # https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc/
+
+
     returns:
      - string containing the command to build the shared library
     """    
@@ -171,7 +173,7 @@ def return_compilation_dict():
     ccflags = defaults['ccflags'] #  = $ENV{BINARY_GRID2_CCFLAGS} // ($defaults{ccflags}) . ($ENV{BINARY_GRID2_EXTRACCFLAGS} // '');
   
     # you must define _SEARCH_H to prevent it being loaded twice
-    ccflags += ' -D_SEARCH_H'
+    ccflags += ' -shared -D_SEARCH_H'
 
     # ensure library paths to the front of the libs:
     libs_content = libs.split(' ')
@@ -204,6 +206,7 @@ def compile_shared_lib(code, sourcefile_name, outfile_name):
     # create compilation command
     compilation_dict = return_compilation_dict()
 
+    # Construct full command
     command = "{cc} {ccflags} {libs} -o {outfile_name} {sourcefile_name} {inc}".format(
         cc=compilation_dict['cc'],
         ccflags=compilation_dict['ccflags'],
@@ -216,13 +219,12 @@ def compile_shared_lib(code, sourcefile_name, outfile_name):
     command = ' '.join(command.split())
 
     # Execute compilation
+    print('Executing following command:\n{command}'.format(command=command))
     res = subprocess.check_output('{command}'.format(command=command),
-        shell=True, stderr=subprocess.STDOUT)
-    print(res)    
-
+        shell=True)
 
-
-    # return command
+    if res:
+        print('Output of compilation command:\n{}'.format(res))
 
 # generate logging lines
 logging_line = autogen_C_logging_code(
@@ -235,4 +237,8 @@ logging_line = autogen_C_logging_code(
 # Generate code around logging lines
 created_code = binary_c_log_code(logging_line)
 
+
+# print(created_code)
+# quit()
+
 compile_shared_lib(created_code, sourcefile_name='custom_logging.c', outfile_name='lib_custom_logging.so')
\ No newline at end of file
diff --git a/binaryc/lib_custom_logging.so b/binaryc/lib_custom_logging.so
new file mode 100755
index 0000000000000000000000000000000000000000..b2c0fa24f9f8a708aa4a26ff82f63ae200029d10
Binary files /dev/null and b/binaryc/lib_custom_logging.so differ