x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Can I load third party DLL in Runtime engine Plugin?

I've created engine plugin where I load third party DLL, I want to use this plugin in standalone game. As per documentation, I need to use "Runtime" type plugin in order to use it in standalone game. But when I try to package it, while building source code it gives me below mentioned linker error.

LogPlayLevel: UnrealBuildTool: UELinkerFixups.cpp.obj : error LNK2019: unresolved external symbol "void __cdecl EmptyLinkFunctionForStaticInitializationMyPlugin2(void)" (?EmptyLinkFunctionForStaticInitializationMyPlugin2@@YAXXZ) referenced in function "void __cdecl UELinkerFixups(void)" (?UELinkerFixups@@YAXXZ)

If I changed plugin type to "Developer" then it build successfully. But Deveoper plugin does not get included while packaging the game.

So please guide me to solve this issue.

Product Version: UE 4.15
Tags:
more ▼

asked Mar 24 '17 at 05:56 AM in C++ Programming

avatar image

Rahul3349
53 4 8 14

avatar image Rahul3349 Mar 24 '17 at 09:54 AM

I meant engine plugin type is "Runtime" and plugin loads third party DLL.

avatar image NymKappa Mar 24 '17 at 10:38 AM

Can you show us your ROOT/Plugins/YourPluginName/Source/YourPluginName.Build.cs ? :)

avatar image Rahul3349 Mar 24 '17 at 11:43 AM

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool; using System.IO; public class MyPlugin2 : ModuleRules { public MyPlugin2(TargetInfo Target) {

     PublicIncludePaths.AddRange(
         new string[] {
             "Runtime/MyPlugin2/Source/MyPlugin2/Public"
         }
         );
             
     
     PrivateIncludePaths.AddRange(
         new string[] {
             "Runtime/MyPlugin2/Source/MyPlugin2/Private"
         }
         );
         
     
     PublicDependencyModuleNames.AddRange(
         new string[]
         {
             "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Slate", "SlateCore", "RHI", "RenderCore", "Projects"
             // ... add other public dependencies that you statically link with here ...
         }
         );
         
     
     PrivateDependencyModuleNames.AddRange(
         new string[]
         {
             // ... add private dependencies that you statically link with here ...    
         }
         );
     
     
     DynamicallyLoadedModuleNames.AddRange(
         new string[]
         {
             // ... add any modules that your module loads dynamically here ...
         }
         );

     
     var path = Path.GetFullPath(Path.Combine(ModulePath, "../../"));
     PublicIncludePaths.Add(Path.Combine(path, "mylib", "include"));

     PublicDelayLoadDLLs.Add("mylib.dll");
     PublicAdditionalLibraries.Add(Path.Combine(path, "mylib", "libs", "mylib.dll.lib"));
 }

 private string ModulePath
 {
     get { return ModuleDirectory; }
 }

}

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Oh wait, I remember now. I had the same issue and I found my answer here. Maybe you have the same issue (copy/paste issue haha :D...).

https://answers.unrealengine.com/questions/92700/uelinkerfixup-error-when-building-packaging.html

more ▼

answered Mar 24 '17 at 12:12 PM

avatar image

NymKappa
692 32 22 56

avatar image Rahul3349 Mar 30 '17 at 08:20 AM

No, above solution is not applicable for my problem.

avatar image NymKappa Mar 30 '17 at 08:24 AM

Can you show me the file where you have the IMPLEMENT_MODULE macro declared ?

avatar image Rahul3349 Mar 30 '17 at 08:53 AM

// Fill out your copyright notice in the Description page of Project Settings.

include "IMyPlugin2.h"

include "myplugin.h"

define LOCTEXT_NAMESPACE "FMyPlugin2Module"

class FMyPlugin2Module : public IMyPlugin2 { public:

 /** IModuleInterface implementation */
 virtual void StartupModule() override;
 virtual void ShutdownModule() override;

};

IMPLEMENT_MODULE(FMyPlugin2Module, MyPlugin2)

void FMyPlugin2Module::StartupModule() { // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module openDLL(); }

void FMyPlugin2Module::ShutdownModule() { // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading, // we call this function before unloading the module.

}

undef LOCTEXT_NAMESPACE

avatar image NymKappa Mar 30 '17 at 09:02 AM

First of all, I dont' see any dll export macro in your class definition. I think it could cause the issue as well, try:

 // Change
 class FMyPlugin2Module : public IMyPlugin2
 // with
 class YOUR_PLUGIN_NAME_IN_CAPS_API ClassName
 // Example
 class FMYPLUGIN2MODULE_API FMyPlugin2Module 
avatar image NymKappa Mar 30 '17 at 09:04 AM

Take a look at one of my plugin:

Header

 #pragma once
  
 #include "ModuleManager.h"
 
 class CLASSICRANGE_API ClassicRangeImpl : public IModuleInterface
 {
 public:
     /** IModuleInterface implementation */
     void StartupModule();
     void ShutdownModule();
 };

CPP:

 #include "ClassicRange.h"
 
 void ClassicRangeImpl::StartupModule()
 {
 }
 
 void ClassicRangeImpl::ShutdownModule()
 {
 }
  
 IMPLEMENT_MODULE(ClassicRangeImpl, ClassicRange)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question