-
Notifications
You must be signed in to change notification settings - Fork 34
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
[MSVC] Plugins fail to load with "badf" #24
Comments
Be sure to mark your |
I do, and so do the example plugins, which also fail. I just saw this: |
After looking through the HLSDK again, I saw that it has a module definition file: https://github.com/ValveSoftware/halflife/blob/master/dlls/hl.def And inside the project file of hldll, it configures module definition file: https://github.com/ValveSoftware/halflife/blob/master/projects/vs2010/hldll.vcxproj#L66 Maybe you can try this approach, as this is also what the original metamod does. I don't have VS2022 around so please try and see if it would resolve your problem. |
Sorry I didn't notice this question. Yes, you will need to either do the module definition file approach, or the pragma approach, or specify /EXPORT linker flags in order to force the export to be the normal name for your plugin. Metamod and the engine expects the name to be in unmangled form. Now that I remember it, even with |
Ok, adding pragmas to every plugin does also fix the problem:
I thought there was something wrong with these pragmas in metamod, but those exist exist for the engine calling That said, I like hzqst's solution better, where metamod loads the |
When compiling plugins using MSVC, they fail to load with "badf" status. This happens when using the binaries from the latest release or compiling from source in MSVC.
Adding this code to metamod fixes the problem:
wootguy@753cfb1
That code comes from hzqst's custom version of metamod-p. I don't know if this is the most correct fix. Are plugin authors supposed to be adding a special pragma if they'll be compling in MSVC?
There was a compile warning for that pragma implying that it would be ignored:
h_export.obj : warning LNK4197: export 'GiveFnptrsToDll' specified multiple times; using first specification
Maybe it just doesn't work in the latest Visual Studio.
The text was updated successfully, but these errors were encountered: