Library load/unload method in golang

I created a shared library in golang and used this library with a go application. I am looking at the function when this library gets load/unload. init() function for library does not work. Using import C, i wrote following code in library

package testlibrary

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
static void con() attribute((constructor));
void con() {
fprintf(stderr,“I’m a constructor\n”);

import “C”
import “fmt”

func init() {
fmt.Println(“init never called”)

But i never get the message which is in con() function.
Can someone suggest the function when a library gets loaded?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.