Using a plugin in C++ code

Your comments here, and in another answer about libraries and interfaces, have been very helpful to me in making clear something I want to do - make a library which can be used as a hard dependency in my projects. However, I can’t find any information on how to do this. If you have a moment to take a look at the question I just posted, I’d really appreciate it.

How did it become a hard dependency? What did he do that created that effect?

@gmpreussner said “We generally discourage the adding of hard dependencies to plug-ins, because for plug-ins to be truly pluggable, the application consuming those plug-ins shouldn’t have to know about what those plug-ins are.”

This seems like completely ridiculous advice.

If you have a plugin, it’s not an abstract interface with multiple pluggable backends. It’s a component of functionality that is not available otherwise.

The ‘CustomMeshComponent’ is not an implementation of an ICustomMesh; it builds custom meshes. Nothing else provides this functionality. If you want the functionality, having a ‘hard’ dependency on this plugin is your only option.

@gmpreussner also said; " If you need access to this module from another module, then it should not be a plug-in. "

That doesn’t make any sense either. ‘Plugins’ are modular components you can add to a project. They can implement an interface, and you can have a plugin implementation that binds to a specific interface, but you don’t have to. In fact, the majority of the plugins and module are not designed that way; only some of them are.

tldr;

Yes, if you want to use the CustomMeshComponent, add ‘CustomMeshComponent’ to your PrivateDependencyModuleNames.

I think what gpm was trying to say that it’s bad practice, not that you couldn’t do it. Though I agree, the “problems” he listed about plugins apply to the core-engine too.

I was just updating some code linking the Core module because guess what, some calls I was using were depreciated, just because someone thought the function name being used since 4.02 was confusing.

Welcome to OOP.

The answer in this post is not working for me. I’m trying to use either CustomMeshComponent.h or ProceduralMeshComponent.h. I cannot get either to include correctly in my c++ actor class extension. I’ve gone through my build.cs and added the lines indicated and it still cannot find it. If I’m using either of these two engine plugins do I need to move the plugin to my projects plugin directory within its local plugins folder? I’ve been searching all over for the answer to this and I keep seeing the same solution (to add those lines to the build.cs) but it doesn’t work for me. Is there a trick to this or some obvious element I’m over looking?

I’m in a similar boat, I’ve got a plugin that I’ve modeled after the LeapMotionController plugin but instead of an engine plugin, it’s a project specific plugin. Now I want to use the blueprint function library from the plugin in an actor in the game, but I can’t figure out how to expose the headers to the game actor. I’ve added the module as a dependency in the .build.cs file, but no luck. Is there something else I should be doing?

Could someone to post one video and youtube about the solution in this post! thanks in advanced.