From 2420a354b426d71c1ca1609b875e104cd1326e7a Mon Sep 17 00:00:00 2001
From: thierry <thierry@home>
Date: Thu, 7 Dec 2023 20:41:20 +0100
Subject: [PATCH] Correct hello-task. Link hello-task with libtikki because of
 usage of ompt_set_task_name

---
 test/CMakeLists.txt |  2 +-
 test/hello-task.c   | 12 ++----------
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2d5f306..1123084 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -4,4 +4,4 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
 
 add_executable(hello hello.c)
 add_executable(hello-task hello-task.c)
-target_link_libraries(hello-task m)
+target_link_libraries(hello-task tikki m)
diff --git a/test/hello-task.c b/test/hello-task.c
index 6b9c8e2..1f91d7b 100644
--- a/test/hello-task.c
+++ b/test/hello-task.c
@@ -2,14 +2,12 @@
 #include <unistd.h>
 #include <omp.h>
 #include <math.h>
-#include "AvailabilityMacros.h"
 
 
 int array[] = { 1, 2, 3, 4};
 
-/*
+/* Extern function: required binary to be link against libtikki.so
 */
-//extern void ompt_set_task_name(const char* name ) __attribute__((weak_import)); //__attribute__((weak));
 extern void ompt_set_task_name(const char* name );
 
 
@@ -19,13 +17,7 @@ int main()
 #pragma omp master
   {
     printf("Hello from %i\n", omp_get_thread_num());
-    if (ompt_set_task_name != NULL) 
-    {
-      printf("Defined symbol\n");
-      ompt_set_task_name("hello");
-    }
-    else
-      printf("Undefined symbol\n");
+    ompt_set_task_name("hello");
 
     #pragma omp task
     {
-- 
GitLab