Legacy:Setting Up VCPlusPlus/General Setup: Difference between revisions

From Unreal Wiki, The Unreal Engine Documentation Site
No edit summary
 
No edit summary
Line 23: Line 23:
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:
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
* '''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
'''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
 
'''[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. ;)
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. ;)


[[Legacy:Setting_Up_VCPlusPlus_The_UnrealScript_Part|next step]]
[[Legacy:Setting_Up_VCPlusPlus_The_UnrealScript_Part|next step]]

Revision as of 13:33, 29 March 2006

Prerequisites

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

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

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