Golang无法打印内部字符串

I want to usego sdk on a c++ project. But i am in a problem, the problem is mainly like this. I am running a go program using a c function, the code can be simplified to below.

package main

 // #include <stdio.h>                                                                                                                                        
 // #include <stdlib.h>                                                                                                                                       
 /*                                                                                                                                                           
 void print() {                                                                                                                                               
     printf("just for test");                                                                                                                                     
 }                                                                                                                                                            
 */                                                                                                                                                           
 import "C"                                                                                                                                                   

 func main() {                                                                                                                                                
     C.print()                                                                                                                                                
 } 

But the result is none, there is no output. Who can tell what's the problem? Thanks very much!

C stdio is buffered, so it doesn't produce output right away. In a C program, exiting main or doing exit() runs atexit handlers, one of which installed by the runtime will flush the stdout buffer. You likely need to do:

void print() {
    printf("just for test");
    fflush(stdout);
}

Or flush stdout somewhere else if you don't want to do it every time for speed reasons.