For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

How to get a "hello world" going in C++

Post Reply
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

How to get a "hello world" going in C++

Post by []KAOS[]Casey »

Links:

fixed Unrealgold header link: http://www.klankaos.com/UnrealGoldFixedHeaders.rar (This may not work on VS2013+!!!) (You will need to modify files and the project to get this to work)

VS2008 project that you can upconvert:  http://www.klankaos.com/BlankSolutionVS2008.zip

BlankProject UCC compilable zip file: http://www.klankaos.com/BlankProjectUC.zip

What you need:

Visual Studio 2008-2013 (2015 works but prints way too many warnings that aren't actually problems...) (Technically 2003/5 work too but this project is made for VS2008 and cant be downconverted easily.. thanks M$)

Public headers (227i if possible.. its easier that way, trust me.)

The ability to unzip and copy paste files





Install your headers to your Unreal main folder: (this is largely preference -- but it's what I do.)

f.e.

c:\unrealgold\227iPublicHeaders\Core
c:\unrealgold\227iPublicHeaders\Engine
c:\unrealgold\227iPublicHeaders\{etc.}

Unzip the supplied BlankSolutionVS2008 to c:\unrealgold\227iPublicHeaders\ such that it reads as

c:\unrealgold\227iPublicHeaders\BlankSolutionVS2008\inc
c:\unrealgold\227iPublicHeaders\BlankSolutionVS2008\src

Unzip the supplied BlankProjectUC to c:\unrealgold\ such that it reads as follows:
c:\unrealgold\BlankProject
c:\unrealgold\BlankProject\Classes

Edit your 227i system Unreal.ini to append EditPackages=BlankProject

Run in command prompt "ucc make -nobind"

make sure BlankProject.uc compiles correctly:

Code: Select all

E:\UnrealGold\System>ucc.exe make -nobind
--------------------Core--------------------
--------------------Engine--------------------
--------------------Editor--------------------
--------------------Fire--------------------
--------------------IpDrv--------------------
--------------------UWindow--------------------
--------------------UnrealShare--------------------
--------------------UnrealI--------------------
--------------------IpServer--------------------
--------------------UBrowser--------------------
--------------------ALAudio--------------------
--------------------UMenu--------------------
--------------------UWebAdmin--------------------
--------------------Emitter--------------------
--------------------UPak--------------------
--------------------UDSDemo--------------------
--------------------BlankProject--------------------
Analyzing...
Parsing BlankActor
Compiling BlankActor
Importing defaultproperties for BlankActor
0 warning(s)

Open BlankProject.sln in visual studio and mash the compile button as hard as you can -- hold onto your butts.

If it works, you should see an output like:

Code: Select all

1>  BlankSolution.vcxproj -> C:\UnrealGold\227i_PublicHeaders\BlankSolutionVS2008\.\Lib\BlankProject.dll
Now go to that path, "C:\UnrealGold\227i_PublicHeaders\BlankSolutionVS2008\.\Lib\" and copy BlankProject.dll to your System folder.

Run unreal, open any level, window your game, type "showlog" as a command and summon "BlankProject.BlankActor".

You should see this in your log

Code: Select all

ScriptLog: Fabricate BlankProject.BlankActor
Log: Bound to BlankProject.dll
Log: 10475.0ms Loading: Package BlankProject
Log: Checking package BlankProject
Log: Hello World! S=Test,I=888
Congrats, you got your first native mod compiled and working!
Last edited by []KAOS[]Casey on Tue Aug 25, 2015 7:11 am, edited 1 time in total.
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: How to get a "hello world" going in C++

Post by []KAOS[]Casey »

To come in this post:

how to get BlankSolution to compile for UnrealGold and UT (I need to download older compilers...)
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: How to get a "hello world" going in C++

Post by han »

It might be worth to mention that the problem with newer compilers basically breaks down to just a few easy to solve issues:

wchar_t is by default treated as a build in type. You need to disable it. See:
https://msdn.microsoft.com/en-us/librar ... .120).aspx

Conformance in for loop scope is forced. You need to disable that too or fix the few affected lines by hand. See:
https://msdn.microsoft.com/en-us/librar ... .120).aspx

UnTemplate.h misses (quite a few) typename keywords. You will get a lot of errors about UnTemplate.h, you basically need adjustments like this:

Code: Select all

            // Old.
            TPair( TTypeInfo::ConstInitType InKey, TTypeInfo::ConstInitType InValue )
            : Key( InKey ), Value( InValue )
            {}

            // Add typename keyword.
            TPair( typename TTypeInfo::ConstInitType InKey, typename TTypeInfo::ConstInitType InValue )
            : Key( InKey ), Value( InValue )
            {}
When working on porting ALAudio to Nerf I got link errors about some TArray related functions missing. Following workaround fixed it.:

Code: Select all

//
// Sound data.
//
#if defined(_MSC_VER) && _MSC_VER>1200
class FSoundData : public TLazyArray
#else
class ENGINE_API FSoundData : public TLazyArray
#endif
{
public:
      USound* Owner;
      void Load();
      FLOAT GetPeriod();
      FSoundData( USound* InOwner )
      : Owner( InOwner )
      {}
};
Last edited by han on Thu Oct 22, 2015 8:10 pm, edited 1 time in total.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
TQY
Posts: 3
Joined: Wed Apr 07, 2021 12:19 pm
Contact:

Re: How to get a

Post by TQY »

Hello. I'm new here and writing tutorial for creating native function calls

I'm trying to compile native dll but it seems that Lib files in public headers are incompatible for 227i.
Is the newest version available.

By the way, I did the same thing for UT99. In this case, it worked!!

Thank you. thx
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: How to get a

Post by []KAOS[]Casey »

TQY wrote: Wed Apr 07, 2021 12:35 pmI'm trying to compile native dll but it seems that Lib files in public headers are incompatible for 227i.
Did you mean 227j? That post was made on 227i a long time ago. the .lib files should directly from the 227i public headers release should work no problem as long as you run 227i client/server.

Post any more info and I can try to help you out.
User avatar
TQY
Posts: 3
Joined: Wed Apr 07, 2021 12:19 pm
Contact:

Re: How to get a

Post by TQY »

[]KAOS[]Casey wrote: Thu Apr 08, 2021 6:20 am
TQY wrote: Wed Apr 07, 2021 12:35 pmI'm trying to compile native dll but it seems that Lib files in public headers are incompatible for 227i.
Did you mean 227j? That post was made on 227i a long time ago. the .lib files should directly from the 227i public headers release should work no problem as long as you run 227i client/server.

Post any more info and I can try to help you out.
No. I did this on 227i.

I mean, I tried to use header and lib file you linked this thread:
http://www.klankaos.com/UnrealGoldFixedHeaders.rar
and succeed to compile dll file.

However, when I run the game, there was an error and show dialog which says "Failed to load entrypoint ?appUnwindf@@YAXPBGZZ" something.
I checked Core.dll in 227i and it doesn't have "?appUnwindf@@YAXPBGZZ" but "?appUnwindf@@YAXPB_WZZ"
and then I thought that this is not 227i public header.

I want to know whether 227i or newer header is available now.
If that so where can I get it?

Regards.
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: How to get a

Post by []KAOS[]Casey »

Ah, I see the problem. the "UnrealGoldFixedHeaders.rar" is for 226b -- "Unreal Gold" only. You'll need a copy of the 227i public headers. When I get home (and I can remember...) I can get you a copy.
User avatar
TQY
Posts: 3
Joined: Wed Apr 07, 2021 12:19 pm
Contact:

Re: How to get a

Post by TQY »

Let me say thank you again here.
I'll also port my sample project to 227 :-)
Post Reply

Return to “C++ Native Mods for UE1”