Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Conversation

@daniellovell
Copy link
Member

@daniellovell daniellovell commented Feb 27, 2025

why?

When loading the assignment plugin DLL in Unity on Windows, i encountered an EntryPointNotFoundException error:

EntryPointNotFoundException: Assignment_EvenAssignment_Assign assembly:<unknown assembly> type:<unknown type> member:(null)

how fixed?

This occurred because C++ functions are name-mangled by default on Windows (thanks bill)

So this pr implements a separate windows dll export mechanism using a def file

The alternative approach of using __declspec(dllexport) with the windows_export_all_symbols feature I tried but resulted in a "library limit of 65535 objects exceeded" error due to the large number of dependencies.

what all change?

  1. Fixed an incorrect path in the main BUILD.bazel file:

    • Changed //sassignment:assignment_plugin to //assignment:assignment_plugin
  2. Created a module definition (DEF) file for Windows:

    • Added assignment.def that explicitly lists the exported function names
    • This ensures the function names are exported exactly as Unity expects them
  3. Updated the Bazel build configuration:

    • Added win_def_file and additional_linker_inputs parameters to the cc_shared_library rule
    • Used Bazel's platform-specific select() to apply these only on Windows

Implement separate dll export mechanism for Windows using a DEF file
Cant use windows_export_all_symbols because symbol limit reached in Assignment
daniellovell added a commit to PisterLab/micromissiles-unity that referenced this pull request Feb 27, 2025
Corresponds to dll built by this PR PisterLab/micromissiles-unity-plugins#2

(monorepo cant come soon enough 😭 )
@daniellovell daniellovell merged commit 0ae863e into develop Feb 27, 2025
4 checks passed
@daniellovell daniellovell deleted the feature/windows-dll-export branch February 27, 2025 18:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants