Passing Cpp object to swift

I have a macOS app project implementing the direct Cpp-swift interop mechanism. The project some cpp classes and few Swift class. I wanted to pass a cpp object to a swift function as parameter, so I can use it in my swift code. But the documentation is not very clear on how to do this. Can some please share a code snippet explaining how can I achieve this?

I have tried the below code, but it is giving linker error.

Swift code:

import StClass_modulemap
public class SwiftClass {
..
   public static func getCppObj (pObj: inout StClass) -> Void
    {
...
    }
}

Cpp code:

#include "Student.hpp"
#include "StClass.hpp"
#include <InteropLib-Swift.h> 

using namespace InteropLib;

void Student::Introduce() {
    
    
    //creating cpp to be passed to swift
    // StClass StObj(50);

   //  Teacher::getCppObj(StObj);
    
    std::cout<< "header included in hpp " <<std::endl;
}

calling Student::Introduce is giving a linker error for StClass

Passing Cpp object to swift
 
 
Q