Passing global variable to external function

Hello,

I need help in passing global string variable to runtime. This is how I have created a global variable and passed to the runtime -

Constant *fname = ConstantDataArray::getString(M->getContext(),"hi", true);
Value *FBloc = new GlobalVariable(*M, fname->getType(), true, GlobalValue::InternalLinkage, fname, "fBloc");

FBloc->getType()->dump();
BitCastInst* BCToAddr = new BitCastInst(FBloc, PointerType::getUnqual(Type::getInt8Ty(M->getContext())),"", First);
FuncInit = M->getOrInsertFunction("funcInit", VoidTy, PtrVoidTy);
IRB.CreateCall(FuncInit, {BCToAddr});```

Unfortunately, runtime gets null pointer

extern “C” void funcInit(void *fName){

std::cout<<“*funcInit”<<(char *)fName;

Breakpoint 1, funcInit (fName=0x0) at handleReal.cpp:66
66 extern “C” void funcInit(void *fName){
(gdb)