Announcement

Collapse
No announcement yet.

Editor wont DLLBind, normal game will

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Editor wont DLLBind, normal game will

    As per the thread title, I have a DLL I am attempting to reference through DLLBind.
    If I launch the game without the editor switch, I can see my DLLMain being called and everything works as expected.
    However if I launch with the editor option my log file states that the DLL could not be bound to.

    I realise that there are different versions of the editor - I am manually running the 32-bit version, with a 32-bit DLL in the correct UserCode location. I have tested with both debug and release versions, different versions of the CRT (10 and 11), and both static and dynamic compilation of the CRT (in case of CRT mismatch). None of these affect the problem.

    Given that the DLL loads without issue in the game proper, I am at a loss as to how this could be an issue with my implementation.

    #2
    Are you launching the editor in the 32-bit version?

    Comment


      #3
      If it works while clicking on UDK (not the editor) you may as well create a shortcut of whatever you are clicking on and add the command line argument editor, create a shortcut, right click, click on properties then select the shortcut tab, on target simply add editor after the path.

      Comment


        #4
        Originally posted by darthviper107 View Post
        Are you launching the editor in the 32-bit version?
        Yes, I am using the 32-bit editor. I am also launching the game in 32-bit mode.

        I have tried launching from a shortcut that has the editor switch, as well as launching from a custom development tool that adds the editor switch.
        Neither of these will DLLBind, they both log a failure message.
        Remove the editor switch from either the shortcut or the tool = DLL binds fine.

        Comment


          #5
          I tried to reproduce this but I was not able to get the same issue than you, I've used an exec function to call a simple DLL function that I've written right now on Visual Studio by creating a new Solution, selecting Win32 Project as the project type and finally choosing DLL, I've left everything by default except for the configuration where I've changed it from Debug to Release, I've tried both in-game and in the editor (on UDK) and had no issue apart from a gametype issue but not related to the DLL I'm pretty sure this issue you are facing is not related to your code however, but I'll "walk" you through the steps I've taken.
          Code:
          #include "stdafx.h"
          #include <Windows.h>
          #include <stdlib.h>
          
          extern "C"
          {
          	__declspec( dllexport) void CreateMessageBox()
          	{
          		//Don't mind the pointer was just testing something
          		const char *ptr_cMessage;
          		ptr_cMessage = ( char* ) malloc( sizeof( *ptr_cMessage ) );
          
          		if( *ptr_cMessage != NULL )
          		{
          			ptr_cMessage = "Window";
          			MessageBoxA( 0, ptr_cMessage, "Pop-up window", MB_ICONERROR );
          		}
          
          		ptr_cMessage=NULL;
          		free( ( char* ) ptr_cMessage );
          	}
          }
          I've built the solution and copied the DLL from the Release folder to this directory:
          C:\UDK\UDK-year-month\Binaries\Win32\UserCode

          and on Unrealscript I simply imported the DLL and used an exec function to show the window

          Code:
          class TestPlayerController extends PlayerController
          	DLLBind( DLLBind );
          
          dllimport final function CreateMessageBox();
          
          exec function ShowWindow()
          {
          	CreateMessageBox();
          }
          PS: I'm on a 32 bit PC here, I haven't had the chance to test that in a 64 bit, also if your DLL is imported in a PlayerController class or Pawn class similar than this example, I would suggest to check the GameType on the editor, I'm quite stumped looking at this issue now which is why I haven't got an idea as to what could be doing this.

          Comment


            #6
            Thanks for the input so far.
            Which version of visual studio and UDK are you using? I also should have mentioned, I am using VS2012 and UDK-2012-10 (I.e the November build, which installs as 2012-10 for some reason).
            <Edit - I also tested with VS2010:
            [0011.94] Warning: Class xxx.xxx can't bind to DLL C:\UDK\UDK-2012-11\binaries\win32\UserCode\xxx.dll
            >

            Comment


              #7
              I'm using Visual Studio 2010 and UDK November build, as for the date that's normal nothing to worry about
              Anyway I wanted to add that I've tried to reproduce this on a 64 bit PC but I wasn't able to get the same issue, although I did get a few warnings at first that it could not bind to the DLL but that was when I was running UDK 64 bit, in the end I just created three .bat files to run UDK with the make commandlet and the editor and finally the game, I've placed the DLL in this directory
              Code:
              C:\UDK\UDK-2012-10\Binaries\Win32\UserCode
              and that is on the 64 bit PC, and I've placed those 3 .bat files in this directory
              Code:
              C:\UDK\UDK-2012-10
              the first .bat file which launches the game is like so
              Code:
              @echo off
              cls
              .\Binaries\Win32\UDK dllmap?Test.TestGame
              dllmap is the test map I've used which was saved in this directory
              Code:
              C:\UDK\UDK-2012-10\UDKGame\Content\Maps
              Test.TestGame is the GameInfo I've used, Test is the folder where the Pawn, playercontroller and GameInfo is located, and TestGame is the name of the GameInfo. This bat file which you should launch at first is the one that "compiles" the scripts
              Code:
              @echo off
              cls
              .\Binaries\Win32\UDK make
              the third one is for the editor
              Code:
              @echo off
              cls
              .\Binaries\Win32\UDK editor -log
              while the Editor was running I simply opened the map I've created in this case this is dllmap and I've checked if the proper gametype was used and I've simply opened the console and typed the name of the exec function which showed the window, I have to admit I took more time doing this than on a 32 bit PC :P

              Comment

              Working...
              X