{"id":20510233,"url":"https://github.com/bmc-labs/xdrk","last_synced_at":"2025-04-13T22:33:33.451Z","repository":{"id":198469187,"uuid":"538640037","full_name":"bmc-labs/xdrk","owner":"bmc-labs","description":"xdrk is a library to open XRK and DRK files, a format by https://www.aim-sportline.com/","archived":false,"fork":false,"pushed_at":"2024-02-01T22:39:26.000Z","size":61619,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"trunk","last_synced_at":"2025-04-10T20:50:28.786Z","etag":null,"topics":["aim","motorsport","rust"],"latest_commit_sha":null,"homepage":"http://libraries.bmc-docs.com/xdrk","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmc-labs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-19T18:21:25.000Z","updated_at":"2025-04-08T00:34:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9a5776b-f575-4086-acfe-e07eef11c8af","html_url":"https://github.com/bmc-labs/xdrk","commit_stats":null,"previous_names":["bmc-labs/xdrk"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fxdrk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fxdrk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fxdrk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fxdrk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmc-labs","download_url":"https://codeload.github.com/bmc-labs/xdrk/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790695,"owners_count":21162073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aim","motorsport","rust"],"created_at":"2024-11-15T20:28:38.914Z","updated_at":"2025-04-13T22:33:33.387Z","avatar_url":"https://github.com/bmc-labs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./misc/aim.png\" alt=\"AiM Sportline Logo\" width=\"15%\" /\u003e\n\u003c/p\u003e\n\n# xdrk\n\n\u003e a library to access files produced by AiM devices\n\nOr rather, a Rust wrapper for the shared library provided by AiM which is\nwritten in C/C++ and provides an unsafe interface. This wrapper does its best\nto make the interface safe, which it does - but it still contains one pain\npoint, which is having to work with write buffers (or, as you'd call them in C,\npointers to head-allocated arrays). However also this is wrapped as tight as it\ncan be.\n\nExecutive summary: safely use the AiM access library for XRK/DRK files.\n\n### Build and test it\n\nBuilding is canonical Rust style:\n\n```sh\ncargo build\n```\n\nIt works on both Linux and Windows 64bit; on Windows, you'll need to use the\n`x86_64-pc-windows-msvc` target which in turn required you to install a few GB\nof MSVC build tools.\n\nTesting is the same, but the `Drop` implementation test has to be run\nseparately since, well, the AiM library does some on-disk file I/O and that\ncan't happen when running tests concurrently:\n\n```sh\ncargo test\ncargo test -- --ignored\n```\n\nIf you have a peak into the `coverage.sh` file, which is what the continuous\nintegration environment runs, you'll notice that here, we run the tests single\nthreaded:\n\n```sh\ncargo test -- --test-threads=1\ncargo test -- --ignored\n```\n\nThis is done because with the flags required by\n[`grcov`](https://github.com/mozilla/grcov), somehow tests are run in separate\nprocesses (I guess?) or something like that - the result is that it f%cks with\nthe globals needed to wrap the AiM library in a thread safe way, and very\nstrange errors occur, so we can't run tests in parallel in CI. _**Should you\nfind yourself running into issues, I suggest you run the tests single threaded\njust like CI does, and see what happens.**_\n\nOn our machines, tests run in a reasonable, sub 60 seconds timeframe. So if you\nare on something vaguely modern, you are not on Windows and you're seeing\nexcessive run times there is probably something wrong. On Windows, tests run\n10x longer since the AiM DLL spends between 10 and 20 seconds opening any\nXRK/DRK file, a process which takes nothing close to a second on Linux.\n\n### Using it\n\nBest is to declare it as a dependency of your project via git.\n\n### Caveats if you're working on this on Windows\n\nMSVC won't link against a .dll and then later load it dynamically, but it also\nwon't \"blindly\" link against a shared object and check if everything is dandy\nat runtime. Well, sort of, because the resource it needs to \"link\" is just a\nfile containing a bunch of obfuscated symbol names and then they still check\nagain at runtime (because, well, there really isn't any other way).\n\nIt is what it is. The good news is that if you have the .dll, you can actually\njust generate this obfuscated-symbols-file using Microsoft's own tooling.\n\nTo link against the AiM library on Windows, you need a .lib file corresponding\nto the .dll file they provide. There is one included in the `aim` directory,\nbut if for whatever reason you need a newer one, read on.\n\nYou should already have the MSVC build tools installed to work with Rust's\n`x86_64-pc-windows-msvc` target. Go ahead and fire up your Visual Studio\ninstaller again and install the C++ CLI tools, or the Windows Foundational\ntools, or whatever your version of Visual Studio calls this stuff; if unsure\njust [Google \"visual studio\ndumpbin\"](https://www.google.com/search?q=visual+studio+dumpbin) or some\nsimilar combination of terms and go from there.\n\nNow that you've installed another 2GB of stuff™, do the following:\n\n1. From Start menu run \"Visual Studio Command Prompt\".\n1. Navigate to `where/you/put/xdrk/aim`\n1. Execute command:\n   `dumpbin /exports libxdrk-x86_64.dll \u003e libxdrk-x86_64.def`\n   This command prints some information about given DLL library in textual\n   form to its standard output. We redirect it to a text file with DEF\n   extension. But to make it real DEF file, we need to edit it.\n1. Open `libxdrk-x86_64.def` in some text editor and edit it to contain only\n   the names of exported functions in form of:\n   ```\n   EXPORTS\n   function_1_name\n   function_2_name\n   function_3_name\n   ```\n   At this point you may also want to compare the DEF file with the one that\n   is provided in the `aim` directory of this repo.\n1. Execute another command:\n   ```\n   lib /def:libxdrk-x86_64.def /out:libxdrk-x86_64.lib /machine:x64\n   ```\n\nAnd there you have it! The so much required LIB file generated from DLL\nlibrary.\n\nI stole this guide [from the\ninternet](https://asawicki.info/news_1420_generating_lib_file_for_dll_library).\nAs always, thank you, internet!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmc-labs%2Fxdrk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmc-labs%2Fxdrk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmc-labs%2Fxdrk/lists"}