Yes, I assumed everyone was on the same page. This is not the C/C++ backend. 
But it doesnt mean you can call those functions, you could:

  * Compile the compiler with `importc` support
  * Statically bind wrappers-hooks (like the compiler does)
  * Dynamically bind wrappers (like NUE does)



For instance, considerer the Twitter example:
    
    
    proc onEditorTick(self: ATickEditorPtr, deltaSeconds: float32) {.ueborrow.} 
=
      let rotator = self.otherActor.getActorRotation() + FRotator(yaw:  -2)
      discard self.otherActor.setActorRotation(rotator, false)
    
    
    
    Run

The implementation to `getActorRotation` is:
    
    
    proc getActorRotation*(self : AActorPtr): FRotator =
      var call  = UECall(self: 0, value: RuntimeField(kind: FieldKind(0),
          intVal: 0), kind: UECallKind(0), fn: UEFunc(name: "GetActorRotation",
          className: "AActor"))
      call.value = ().toRuntimeField()
      call.self = cast[int](self)
      let returnVal {.used, inject.} = uCall(call)
      when FRotator is ptr:
        if returnVal.get.intVal == 0:
          return nil
        else:
          return cast[FRotator](returnVal.get.intVal)
      else:
        return returnVal.get.runtimeFieldTo(FRotator)
    
    
    
    Run

Which then goes into 
<https://github.com/jmgomez/NimForUE/blob/84f986f8e1a5531d679aa00bf4c7bdb50f0ef0fc/src/nimforue/vm/uecall.nim#L245>
 and figure how to call the native function.

The `ueborrow` pragma, what it does is that it replaces the implementation of 
an existing function, meaning that when called the function inside the VM is 
the one that will be called instead of the real implementation. It's a bit more 
convoluted but happens in here for those interested: 
<https://github.com/jmgomez/NimForUE/blob/84f986f8e1a5531d679aa00bf4c7bdb50f0ef0fc/src/nimforue/vm/nimvm.nim#L181>

Reply via email to