Skip to content
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

A little fleshing out of the dynamic library header #289

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

gblues
Copy link
Contributor

@gblues gblues commented Dec 26, 2022

== DETAILS

This commit provides two tweaks:

  1. Add the "library not found" error, value of -6, to the OSDynLoad_Error enums

  2. Define an OSDynLoad_ExportType enum and use it in place of the isData boolean parameter to avoid raw true/false values in the code and make usages easier to read:

    // before - unclear what "false" means in this context
    last_error = OSDynLoad_FindExport((OSDynLoad_Module)lib, false, proc, &ptr_sym);

    vs:

    // after - aha, we're looking up a function symbol 
    last_error = OSDynLoad_FindExport((OSDynLoad_Module)lib, OS_DYNLOAD_EXPORT_FUNC, proc, &ptr_sym);

== DETAILS

This commit provides two tweaks:

1. Add the "library not found" error, value of -6, to the
   `OSDynLoad_Error` enums
2. Define an `OSDynLoad_ExportType` enum and use it in place of the
   `isData` boolean parameter to avoid raw `true`/`false` values in the
   code and make usages easier to read:

   ```c
   // before - unclear what "false" means in this context
   last_error = OSDynLoad_FindExport((OSDynLoad_Module)lib, false, proc, &ptr_sym);
   ```
   vs:
   ```c
   // after - aha, we're looking up a function symbol
   last_error = OSDynLoad_FindExport((OSDynLoad_Module)lib, OS_DYNLOAD_EXPORT_FUNC, proc, &ptr_sym);
   ```
@Maschell
Copy link
Contributor

Where is that -6 coming from?
decaf defines ModuleNotFound as 0xBAD10023. It's probably a good idea to add the missing enum values from decaf to wut

@gblues
Copy link
Contributor Author

gblues commented Dec 28, 2022

The -6 comes from my own experiments trying to use OSDynload_Acquire() with WUT-built RPLs, and I poked around via Ghidra to see the context of the -6 return code.

@fincs fincs merged commit d830b51 into devkitPro:master Feb 17, 2023
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.

3 participants