Download

Statically linking plugins to a game project..

Is there a best practice or tutorial for this?

In the plugin documentation, it says:

However, in this discussion, it has been thoroughly discouraged to do just that:

https://answers.unrealengine.com/questions/83155/cannot-find-dll-when-using-an-uobject-exported-via.html

So, for my current project, I went the route of just putting it in the game code, however, the question still stands - who is correct and what is the best way to statically link a plugin to a game?

I think there is a valid use case, for example specific applications that all rely on a certain input tracker device or whatever. Or the other example, where you define new UObjects, to be used in many applications. Why would you copy/paste the module in all those different game projects instead of just referencing a statically linked plugin?

The reason Im asking if there is a best practice or if it is downright forbidden, is because I tried to statically link my plugin but I ran in the problem of the UE Editor having to load my plugin and being unable to load it from the plugin’s directory. Is this a bug or intentional?

Also related: How do I Statically link a plugin to my game code - UE4 AnswerHub

Unless I misunderstand, all of my input plugins currently do this by exposing custom UObjects that get emitted from each controller event. If you use these plugin classes and then remove the plugins, on restart, the blueprints will generally remove the links to the objects with warnings.

Have a look at their source to see if this isn’t what you’re trying to do.

Oh yeah, I’m not talking about Blueprints because as discussed in the first link, they only get evaluated at runtime and so can dynamically reference plugins.

I’m talking about statically linking to a plugin from within C++ code.

The plugins support C++ binds as well, you can reference them within your C++ code with the right header after including the plugin module in your project build rules. This is shown in the razer hydra video near then end.

Ah cool, just saw it! Great plugin by the way.

Guess I’ll have to compare and see what went wrong on my end…

What I would like to know is HOW you “hard link” vs “static” or “dyanmic” or “monolitic” link. The docs just mention the linkage type but don’t mention how to do any of them.