I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Legacy:Setting Up VCPlusPlus/General Setup

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Prerequisites[edit]

In order to write native code (DLLs) for Unreal, you need the following:

  • Unreal Engine
  • Unreal Headers
  • C Compiler for windows (I recommend Micro$oft Visual C++ 6)

Package folders[edit]

To start, you should create a new Unreal package. Set up package folders as normal, using a package name that describes your project, but add the following extra subfolders:

{Base Directory}\YourModPackage\C 
contains your native C code
{Base Directory}\YourModPackage\Inc 
contains your headers
{Base Directory}\YourModPackage\Proj 
contains M$VC proprietary data

Creating the project[edit]

Open VC. Create a new project. Select "Win32 Dynamic-Link Library". Save it under $UNREALROOTDIR\YourModPackage\Proj . A wizard appears; select "An empty DLL project". Confirm the settings.

Add a new CPP file to your project. Save it in the $UNREALROOTDIR\SQLite\C directory.

Delete the debug version of your project; you will be better off with Release DLLs as the debug code may crash Unreal. Next, select Settings from the Project menu. Select the "C/C++" tab, Category: general. Delete all preprocessor directives, then add the following:

  • WIN32, WINDOWS, _WINDOWS needed so the compiler+code knows it's supposed to run on the windows platform
  • UNICODE, _UNICODE we want unicode versions of our code
  • YourModPackage_API=DLL_EXPORT ; DLL_EXPORT prefixed functions will get an entry in a special section of the DLL file, making it available to Unreal

Go to the link tab; select general again. The output filename should be changed to $UNREALROOTDIR\System\YOURPACKAGENAME.dll. Delete everything listed in the Object/library modules text field, then add core.lib and engine.lib . If you're using other classes (like ones defined in deusex.h, you have to include the corresponding .lib file as well. People using your native class in their code will have to include your .lib file. ;)

Next step: Legacy:Setting Up VCPlusPlus/The UnrealScript Part