In general, there is such a thing. Unicorn Engine. Allows you to run emulation of different processors. It has a ready add-in for .NET, that's just written in F #. And there, when it cannot create an object the actual engine gives an error of the type: "XX, Unable to create Unicorn engine".
let checkResult(errCode: Int32, errMsg: String) = if errCode <> Common.UC_ERR_OK then raise(ApplicationException(String.Format("{0}. Error: {1}", errMsg, errCode)) in the engine itself there is a function char * strrerror (int code); And it is even imported (but here, Iām saying that the problem is, it is imported as an IntPtr strerror (Int)) attempt to make to the forehead like this:
let checkResult(errCode: Int32, errMsg: String) = if errCode <> Common.UC_ERR_OK then raise(ApplicationException(String.Format("{0}. Error: {1} {2}", errMsg, errCode, binding.Strerror(errCode))) causes an error in the next let
Error 2 Probably incorrect indents: this marker is out of context, starting at position (50:45). Try increasing the indentation of the marker or use standard formatting conventions. F: .projects.cpp.msvc \ UnicornManaged \ Unicorn.fs 52 5 UnicornManaged
I assume that the problem is that the function is imported as an IntPtr and not a String. (Although, maybe I did something wrong syntactically. Nevertheless, I donāt know this language)
[<AutoOpen>] module private Imported = . . . [<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>] extern IntPtr uc_strerror(Int32 err) . . . let instance = {new IBinding with . . . member thi.Strerror(err) = uc_strerror(err) . . . } Who is familiar with this f #? Tell me how to fix the code