Skip to content

WIP: C Exports, C# Exports and Fixing CI Workflows #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

Sewer56
Copy link
Contributor

@Sewer56 Sewer56 commented Feb 25, 2024

This PR builds on:

So please address that first, as changes from those PRs will show as a diff here otherwise.


[This branch still needs some cleanup regarding string formatting, and error handling]

This PR adds C bindings (both dynamic and static libraries), as well as auto generated C# bindings.
This includes tests against the C bindings, the C# bindings are untested. The bindings only cover the core API right now, now RPC. They're not yet perfect with regards to error handling, am in a rush, unfortunately.

Aside from that, some workflow changes have been made:

  • Fixed CI Workflows [they now pass, previously they were very outdated and failed]
  • CI builds static and dynamic C libraries + bindings.
  • CI builds .NET NuGet library.
  • CI now runs tests against WINE in addition to the standard tests.
  • Fixed a bug in CI (features enabled by default)
  • Publishing a tag now makes a release (on GitHub Releases, NuGet, crates.io)

You may want to make changes to these workflows.
To suit your personal preferences, also because they currently reference the actions I made for my Reloaded libraries, in the time since I've started working with Rust (7-8 months ago).


The C dynamic libraries are built with into-x86-from-x64 out of the box.
They are approx 220kB for i686 and 300kB for x86_64.

For most people that's probably 'good enough', but not for me.

In the future I plan to:

  • Replace goblin with own minimal PE parser that gets only info I need.
  • Replace iced-x86 with manual assembly.
  • Remove string formatting and unnecessary conditional code.
  • Remove string conversions (if present). Instead expose direct APIs for ANSI (A) and UTF-16 (W)

I hope to achieve sub <50kB size.

I'll throw the ones that don't affect the public API as future PRs. After that, I'll probably hard fork the project to strip the functionality I don't need.

Cargo: Set default targets as Windows

Updated: Script to run `wine` on host, for faster testing.
This is 'technically correct', and also fixes Wine.
* This is needed for architectures with a separate instruction and data cache.
* In x86 and x64 these are unified, so this is not necessary.
* If it turns out this is needed for e.g. x64 emulation on ARM64, it may be re-enabled one day.
@Sewer56 Sewer56 marked this pull request as draft February 25, 2024 18:28
@Sewer56 Sewer56 changed the title Adding: C Exports, C# Exports and Fixing CI Workflows WIP: C Exports, C# Exports and Fixing CI Workflows Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant