IModuleInterface problems. I can't tell if module is loaded...or debug it.

Some initial questions re IModuleInterface.

  1. Is there no wizard to create the skeleton class(es) for this?
  2. Are they required to be singleton objects? (the example I use was from a github project that implemented it this way, is it necessary to be a singleton object?
  3. Is the module compiled into a separate dll of its own? I noticed (after having problems), that my project did NOT make a separate dll (ue 4.24), but the original project did make a separate dll of the IModuleInterface derived part (ue 4.10). Is my project updated improperly? Should I have a separate dll for the IModuleInterface part?
  4. For this function
    FModuleManager::LoadModuleChecked(“MyModuleName”);
    What is “MyModuleName” is that the name of the dll file? Or is it just some friendly name that could be anything?
  5. I have debug symbols set up, and doing a debug build. But I can’t step into the derived class code (the one derived from IMyInterface)
    I put a MessageBox window to display, in the derived class to see if it got run, but no message box window pops up. (I can test and put a message box window in other code, it will pop up. So, I do not even know if module even got loaded. I am assuming it never did.
  6. Can you debug a module(again I can’t seem to step into module code)?
  7. Is module dynamically loaded like a dll? (I don’t mean in the way the
    “new” operator would do it). Why can’t I step into module code to see what is going on?

Below is a general way stuff is set up. When I call “Get()” it should load a singleton object. I can not step into static function. When I put a breakpoint OUTSIDE of module code…like this…
MyDerivedClass& MyObject(IMyInterface ::Get());
If I add “MyObject” to debug watch window, it is unable to evaluate it. (it is marked with red X icon). Why is this? I can not determine if I got anything back as the expression is not evaluatable for some reason.
7) In my derived class, I implement “DoStuff()” method (see below).
A am unable to step into this code, the break point is hollow in the derived class source file, but not in the source file that calls that method.
MyOject.DoStuff(); <— can’t step into code, and no exception is thrown.

I have an interface derived from IModuleInterface

class IMyInterface : public IModuleInterface
{
public:
	static inline IMyInterface& Get()
	{
		return FModuleManager::LoadModuleChecked<IMyInterface>("MyModuleName");
	}

	static inline bool IsAvailable()
	{
		return FModuleManager::Get().IsModuleLoaded("MyModuleName");
	}

public:
	.....interface methods....
		virtual void DoThis();
};

What is the advantage of using IModuleInterface? It is unclear to me.
Why not just create a new C++ class derived from “none” and do stuff in that class, instead of using IModuleInterface? Or derived from “pawn” etc…
What is the advantage of IModuleInterface over the “normal” approach?

I checked…in old UE4.10 in plugins folder there is a “binaries” folder and there is a dll that is the one for the iModuleInterface stuff.
In new UE4.23 version of project there is also a “binaries” folder under the plugins folder. But no dll is there…also no build errors to indicate anything is wrong.
For both UE4.10 and UE4.23 there is no 3rd project file. Only the UE4.x project file and the plugin project file that you get from creating a new plugin project…this project is not the iModuleInterface stuff…it’s the normal project I guess.
So how is UE4.10 generating the iModuleInterface dll without a separate project specific to it?
Just to clarify…in UE…you go to plugins dialog and create a blank new plugin. This is what gets its own VS project file. The iInterfaceModule does not seem to get it’s own VS project file even though a separate dll is created.
So this is what is made in UE4.10
GameApp.exe
MyThingPlugin.dll <— made from doing new plugin in UE (this has a VS *.vcxproj file)
MyThing.dll <---- made by manually adding iModuleInterface *.h + *.cpp + build.cs files, this does NOT have a VS *.vcxproj file, so how is it created?

So this is what is made in UE4.23
GameApp.exe
MyThingPlugin.dll <— made from doing new plugin in UE (this has a VS *.vcxproj file)
MyThing.dll <---- is NOT made.(even though it has the same files as for UE4.10)

I’m 99% sure that I’m supposed to have a MyThing.dll file generated (that is from IModuleInterface stuff). I don’t know why it is not being generated.
In UE4.10 it gets generated, but there is no explicit VS project file for it, so I don’t know how it gets generated.

There is alot to unpack here and it seems that you are confused about many things. I’m still unsure of what you are trying to do but I’ll try to help as much as I can and know.

  1. Skeleton class for doing what exactly? What are you trying to achieve?

  2. I’m not sure what you mean by this but I would assume you are talking about FModuleManager? In that case, yes, FModuleManager is a singleton class since it’s responsible for loading and unloading all modules, it’s the global manager.

  3. All modules are compiled seperately into a dll. You can see an example of this in your binaries folder or the binaries folder of the engine path. If you have built the editor you will see many DLLs starting with UnrealEditor-ModuleName.dll

  4. “MyModuleName” is the name of the module or to be more precise, the name that is written in the IMPLEMENT_MODULE macro in the CPP file for the module. LoadModuleChecked pretty much checks if the module is valid and loads it if it is.

  5. Most likely because it hasn’t been loaded.

  6. Yes, you can debug all modules.

  7. DLL stands for dynamic-link library, so yes, it’s dynamically loaded. (“new” operator? What do you mean?)

I don’t think in your case you’re suppose to use IModuleInterface, it’s made for modules or plugins. When you create a project a module is already generated and implemented for your project so it can be loaded into the engine. Usually when people want to seperate their codebase and split them into different libraries they would create a new module and then add the module to the target file.

Thank you for your help…I shall explain more fully what the issue is…
I think I don’t have to do it this way, that is, the way the original github project did it using UE4.10. It is a plugin that is being made…
(I shall continue my response in next post)

  1. Skeleton class for doing what exactly? What are you trying to achieve?

I am following the steps here.
https://puppet-master.net/blog/docs/unreal-engine-4/programming/create-an-engine-plugin-using-blank-plugin/

I don’t mean 3d skeleton…I meant a wizard that will generate all the initial .h,.cpp and/or *.cs files for you. This is probably a deprecated method now. That is, doing it manually like that page describes.

(in UE4.23)If I go to Edit->Plugins …then click new plugin…
If I name my plugin “Webcamera” it will append “Plugin” to that…
And make WebcameraPlugin.h and a WebcameraPlugin.cpp files.
The WebcameraPlugin.h has nothing.
The WebcameraPlugin.cpp contains this macro.
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, WebcameraPlugin, “WebcameraPlugin” );
At the time I did not know this creates an IModuleInterface derived class thru the macro.

Since it derives from IModuleInterface…I may not need to do the steps in at that URL I mentioned. I will try and use this class and not a separate manually created IModuleInterface derived class (as per that web page). And see if that works out.
The “problem” may be that it was necessary, because there are nodes that are meant to be added to an event graph via UPROPERTIES. That may have required doing an additional IModuleInterface class and object. (as per that URL I mention at top of post.