Want to call shared library function same as init which go-application have

I created a shared library from install -linkshared -buildmode=shared cavwrapperlib with option.
I have written init method in it. and I have loaded this library with application and compiled my application with go build -linkshared main.go
how can I invoke library method without calling them application same as C support attribute((constructor))

package cavwrapperlib
import “fmt”
func init() {
fmt.Println(“Init called”)


package main

import “cavwrapperlib”
func main(){
fmt.Println(“inside main”)

Are you asking how to load a shared lib package without running its init functions?

He’s trying to ask is there any way we can call the init() function and then do some work in init function, as what we are trying to do is to initialize some native code through init function so that we don’t have to make any change in the main application, as soon the as application runs, over code inside init function should execute.

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