} /* LoadNativeLibrary() */ protected override bool BindNativeLibrary() { // bind RobulabSpecificDLLSettings._dllInstantiateEntryPointName entry point to delegate callback if ( ( this.Instantiate = Marshal.GetDelegateForFunctionPointer<InstantiateDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllInstantiateEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind InstantiateDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllInstantiateEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded InstantiateDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllDeleteEntryPointName entry point to delegate callback if ( ( this.Delete = Marshal.GetDelegateForFunctionPointer<DeleteDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllDeleteEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind DeleteDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllDeleteEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded DeleteDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllInitializeEntryPointName entry point to delegate callback if ( ( this.Initialize = Marshal.GetDelegateForFunctionPointer<InitializeDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllInitializeEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind InitializeDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllInitializeEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded InitializeDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllExecuteOneStepEntryPointName entry point to delegate callback if ( ( this.ExecuteOneStep = Marshal.GetDelegateForFunctionPointer<ExecuteOneStepDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllExecuteOneStepEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind ExecuteOneStepDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllExecuteOneStepEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded ExecuteOneStepDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllGetIC4EntryPointName entry point to delegate callback if ( ( this.GetIMU = Marshal.GetDelegateForFunctionPointer<GetIMUDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllGetIMUEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind GetIMUDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllGetIMUEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded GetIMUDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllGetLocalizationEntryPointName entry point to delegate callback if ( ( this.GetLocalization = Marshal.GetDelegateForFunctionPointer<GetLocalizationDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllGetLocalizationEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind GetLocalizationDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllGetLocalizationEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded GetLocalizationDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllGetOdometryEntryPointName entry point to delegate callback if ( ( this.GetOdometry = Marshal.GetDelegateForFunctionPointer<GetOdometryDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllGetOdometryEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind GetOdometryDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllGetOdometryEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded GetOdometryDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllGetBatteryLevelEntryPointName entry point to delegate callback if ( ( this.GetBatteryLevel = Marshal.GetDelegateForFunctionPointer<GetBatteryLevelDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllGetBatteryLevelEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind GetBatteryLevelDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllGetBatteryLevelEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded GetBatteryLevelDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllGetEmergencyStopStateEntryPointName entry point to delegate callback if ( ( this.GetEmergencyStopState = Marshal.GetDelegateForFunctionPointer<GetEmergencyStopStateDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllGetEmergencyStopStateEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind GetEmergencyStopStateDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllGetEmergencyStopStateEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded GetEmergencyStopStateDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllResetEmergencyStopStateEntryPointName entry point to delegate callback if ( ( this.ResetEmergencyStopState = Marshal.GetDelegateForFunctionPointer<ResetEmergencyStopStateDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllResetEmergencyStopStateEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind ResetEmergencyStopStateDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllResetEmergencyStopStateEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded ResetEmergencyStopStateDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllResetOdometryEntryPointName entry point to delegate callback if ( ( this.ResetOdometry = Marshal.GetDelegateForFunctionPointer<ResetOdometryDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllResetOdometryEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind ResetOdometryDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllResetOdometryEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded ResetOdometryDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllResetLocalizationEntryPointName entry point to delegate callback if ( ( this.ResetLocalization = Marshal.GetDelegateForFunctionPointer<ResetLocalizationDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllResetLocalizationEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind ResetLocalizationDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllResetLocalizationEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded ResetLocalizationDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllResetMissionEntryPointName entry point to delegate callback if ( ( this.ResetMission = Marshal.GetDelegateForFunctionPointer<ResetMissionDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllResetMissionEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind ResetMissionDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllResetMissionEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded ResetMissionDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllSetLinearVelocityTargetEntryPointName entry point to delegate callback if ( ( this.SetLinearVelocityTarget = Marshal.GetDelegateForFunctionPointer<SetLinearVelocityTargetDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllSetLinearVelocityTargetEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind SetLinearVelocityTargetDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllSetLinearVelocityTargetEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded SetLinearVelocityTargetDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllSetAngularVelocityTargetEntryPointName entry point to delegate callback if ( ( this.SetAngularVelocityTarget = Marshal.GetDelegateForFunctionPointer<SetAngularVelocityTargetDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllSetAngularVelocityTargetEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind SetAngularVelocityTargetDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllSetAngularVelocityTargetEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded SetAngularVelocityTargetDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllStartMissionEntryPointName entry point to delegate callback if ( ( this.StartMission = Marshal.GetDelegateForFunctionPointer<StartMissionDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllStartMissionEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind StartMissionDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllStartMissionEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded StartMissionDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // bind RobulabSpecificDLLSettings._dllStopMissionEntryPointName entry point to delegate callback if ( ( this.StopMission = Marshal.GetDelegateForFunctionPointer<StopMissionDelegate>( NativeDLLInteropServices.GetProcAddress(this.m_handle, RobulabSpecificDLLSettings._dllStopMissionEntryPointName) ) ) == null ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.BindNativeLibrary() : failed to bind StopMissionDelegate to corresponding entry point [" + RobulabSpecificDLLSettings._dllStopMissionEntryPointName + "] : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.BindNativeLibrary() : binded StopMissionDelegate entry point callback via GetProcAddress() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // success return true; } /* BindNativeLibrary() */
protected override bool ReleaseHandle() { return NativeDLLInteropServices.FreeLibrary(this.handle); }
} /* StopMission */ #endregion #region .dll native library handling protected override bool LoadNativeLibrary() { // set default loading policies if (!NativeDLLInteropServices.SetDefaultDllDirectories((uint)NativeDLLInteropServices.DirectoryFlags.LOAD_LIBRARY_SEARCH_DEFAULT_DIRS)) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.LoadNativeLibrary() : failed to set default dll search path policy : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.LoadNativeLibrary() : set current search path policy via SetDefaultDllDirectories() syscall [" + NativeDLLInteropServices.DirectoryFlags.LOAD_LIBRARY_SEARCH_DEFAULT_DIRS + "]." ); // add path to system if ( (NativeDLLInteropServices.AddDllDirectory(RobulabSpecificDLLSettings._dllPath) == 0) || (NativeDLLInteropServices.AddDllDirectory(RobulabSpecificDLLSettings._dllBoostPath) == 0) ) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.LoadNativeLibrary() : failed to add dll directory search path : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.LoadNativeLibrary() : adding current search path to process via AddDllDirectory() syscall [" + RobulabSpecificDLLSettings._dllPath + " | " + RobulabSpecificDLLSettings._dllBoostPath + "]." ); // load lib if ((this.m_handle = NativeDLLInteropServices.LoadLibrary(RobulabSpecificDLLSettings._dllName)).IsInvalid) { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonRobulabHandle.LoadNativeLibrary() : failed to load dll : " + Marshal.GetLastWin32Error() ); // fail return false; } /* if() */ // log UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonRobulabHandle.LoadNativeLibrary() : loaded library handle via LoadLibraryEx() syscall [" + RobulabSpecificDLLSettings._dllName + "]." ); // success return true; } /* LoadNativeLibrary() */