Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

AngelScript on WindowsRT


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 NiteLordz   Members   -  Reputation: 421

Like
0Likes
Like

Posted 27 December 2013 - 06:20 AM

I am in the process of porting my engine to Windows Store and Windows Phone 8.  I have encountered a problem with scripting however.  On all platforms the library compiles.  Upon execution of and start up is when the problem shows.

 

I have traced through start up, and when i get to this line of code 

 

engine->RegisterObjectType("Array<class T>", 0, asOBJ_REF | asOBJ_TEMPLATE);

 

that fails with an error code of -7, and "configFailed" is then set to true, at which none of my scripts compile.  All of this runs perfectly fine on Windows 8 (Desktop apps).  I am not sure what configuration setup i need to have for Windows RT or WP8.

 

Thanks for any help 

 

It is also throwing a -17 error, InvalidConfiguration.  This leads me to think i am missing a setting or define that is needed.


Edited by NiteLordz, 27 December 2013 - 06:54 AM.

Code makes the man

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3375

Like
0Likes
Like

Posted 28 December 2013 - 09:01 AM

It is strange that RegisterObjectType() returns -7 (asNOT_SUPPORTED). Are you certain that it is this call that returns this error?

 

Anyway, I guess Windows RT requires a different configuration in as_config.h to work properly with native calling conventions. Can you provide a list of the predefined macros that the compiler uses when compiling for Windows RT? I'll need that to see what can be used to identify Windows RT as the target and decide how to configure the library for it.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 NiteLordz   Members   -  Reputation: 421

Like
0Likes
Like

Posted 28 December 2013 - 09:34 AM

i have tracked it down further, and found that the calling convention is not supported, thus returning -17, invalid configuration.  after that, all other register calls return -7.  


Code makes the man

#4 NiteLordz   Members   -  Reputation: 421

Like
0Likes
Like

Posted 28 December 2013 - 09:37 AM

as for preprocessor defines, is there anything in particular you would like?  i program mostly in windows store and RT, and i know a few of the triggers i go off of, and i have a few custom ones that i use within the engine.

 

this url provides a few of the techniques that i use to define my application for my enterprise solutions as i have to support ARM, X86, X64 and Windows Phone 8.

 

http://social.msdn.microsoft.com/Forums/windowsapps/en-US/3965645c-978c-4148-b32c-1853f7fd22b3/platform-defined-macros-for-windows-store-app?forum=winappswithnativecode


Code makes the man

#5 Andreas Jonsson   Moderators   -  Reputation: 3375

Like
0Likes
Like

Posted 28 December 2013 - 10:22 AM

Probably the only thing that needs to change in as_config.h is the following:

 

Line 465 :

 

#ifdef _ARM_

 

to

 

#if defined(_ARM_) || defined(_M_ARM)

 

Can you give that a try and see if it resolves the problem?


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#6 NiteLordz   Members   -  Reputation: 421

Like
0Likes
Like

Posted 28 December 2013 - 10:32 AM

Applying that addition, i receive 6 unresolved errors for 

Error	1	error LNK2019: unresolved external symbol armFunc referenced in function "unsigned __int64 __cdecl CallSystemFunctionNative(class asCContext *,class asCScriptFunction *,void *,unsigned long *,void *,unsigned __int64 &)" (?CallSystemFunctionNative@@YA_KPAVasCContext@@PAVasCScriptFunction@@PAXPAK2AA_K@Z)	D:\Development\KeefersKorner\Aurora\Development\Build\WinStore\Engine\Urho3D\AngelScript.lib(as_callfunc_arm.obj)	Urho3D

all stemming from as_callfunc_arm.obj

 

On line 646 i also saw that define, so i applied the additional define there, but no joy.

 

Would it be easier to discuss more real time, email, etc... ?


Code makes the man

#7 Andreas Jonsson   Moderators   -  Reputation: 3375

Like
0Likes
Like

Posted 28 December 2013 - 11:25 AM

The missing symbols armFunc?? are implemented in as_callfunc_arm_msvc.asm. You'll need to include this when compiling the library for ARM CPUs. 

 

Since it is an assembler file you'll probably need to use a custom build option. Unfortunately I don't know the command line tool for compiling arm assembler routines, but I suppose it is similar to what is used for x64:

 

ml64.exe /c /nologo /Fo$(OutDir)as_callfunc_x64_msvc_asm.obj /W3 /Zi /Ta %(RootDir)%(Directory)\%(Filename)%(Extension)

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#8 NiteLordz   Members   -  Reputation: 421

Like
0Likes
Like

Posted 30 December 2013 - 08:58 AM

So i have it compiling (well assembling) the as_callfunc_arm_msvc.asm file.  It compiles out the library, upon linking i get an error message saying the obj file can not be found.

Error	1	error LNK1181: cannot open input file 'C:\@Projects\TFS Cloud\Aurora\Development\Temp\Store\AngelScript\Debug\as_callfunc_arm_msvc.obj'	C:\@Projects\TFS Cloud\Aurora\Development\Build\WinStore\Third Party\AngelScript\LINK	AngelScript

I am using Visual Studio 2013, and i have added the Microsoft masm Build Customization File target as checked, and also in the properties of the asm file i have "Item Type" set to Microsoft Macro Assembler, and under "Object File" i have "Make All Symbols Public" set to yes.

 

I apologize, but my lack of asm skills is very apparent lol.

 

Thanks much in advance


Code makes the man

#9 Andreas Jonsson   Moderators   -  Reputation: 3375

Like
0Likes
Like

Posted 30 December 2013 - 10:05 AM

Sounds like the assembly output file (as_callfunc_arm_msvc.obj) didn't end up in the directory where the linker expected it.

 

Can you send me the MSVC project file (*.vcxproj) for the library? I'll see if I can spot the mistake.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#10 NiteLordz   Members   -  Reputation: 421

Like
0Likes
Like

Posted 30 December 2013 - 10:55 AM

I have attached the project file that you requested. 

Attached Files


Code makes the man

#11 Andreas Jonsson   Moderators   -  Reputation: 3375

Like
0Likes
Like

Posted 30 December 2013 - 02:34 PM

Hmm. I see Microsoft has changed the layout of the .vcxproj file since MSVC2012.

 

In your project file I only found the following related to the assembler files:

 

  <ItemGroup>
    <None Include="..\..\..\..\Source\ThirdParty\AngelScript\Source\as_callfunc_arm_gcc.S" />
    <MASM Include="..\..\..\..\Source\ThirdParty\AngelScript\Source\as_callfunc_arm_msvc.asm">
      <FileType>Document</FileType>
    </MASM>
    <None Include="..\..\..\..\Source\ThirdParty\AngelScript\Source\as_callfunc_arm_xcode.S" />
    <MASM Include="..\..\..\..\Source\ThirdParty\AngelScript\Source\as_callfunc_x64_msvc_asm.asm">
      <FileType>Document</FileType>
    </MASM>
  </ItemGroup> 

 

But there is no information on how the files should be built, much less the fact that only the arm version should be included in the ARM build and only the x64 version should be included in the x64 build. Perhaps MSVC2013 stores this information somewhere else?

 

In the MSVC2012 project file I have it looks like this:

 

  <ItemGroup>
    <CustomBuild Include="..\..\source\as_callfunc_x64_msvc_asm.asm">
      <FileType>Document</FileType>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe /c  /nologo /Fo$(OutDir)as_callfunc_x64_msvc_asm.obj /W3 /Zi /Ta %(RootDir)%(Directory)\%(Filename)%(Extension)</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)as_callfunc_x64_msvc_asm.obj;%(Outputs)</Outputs>
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe /c  /nologo /Fo$(OutDir)as_callfunc_x64_msvc_asm.obj /W3 /Zi /Ta %(RootDir)%(Directory)\%(Filename)%(Extension)</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)as_callfunc_x64_msvc_asm.obj;%(Outputs)</Outputs>
    </CustomBuild>
  </ItemGroup>

 

(of course, I don't have a WinRT target in my project yet, so there is no compilation step for the arm assembler file.)

 

Have you checked that the as_callfunc_arm_msvc.obj is actually generated somewhere when compiling the library? If so, in what directory is it being generated? If it is not generated, check what command MSVC is actually running when getting to the assembler files (the project settings should have an option to visualize the command line).


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#12 Andreas Jonsson   Moderators   -  Reputation: 3375

Like
0Likes
Like

Posted 30 December 2013 - 02:51 PM

Hah, I forgot to read my own manual. I had already included instructions on how to compile the as_callfunc_arm_msvc.asm file there. rolleyes.gif

 

As far as I can tell armasm is still the tool that should be used to compile the as_callfunc_arm_msvc.arm file for WinRT/Windows Phone, so you need to include a custom build step with the proper command line for that tool.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#13 Andreas Jonsson   Moderators   -  Reputation: 3375

Like
0Likes
Like

Posted 05 January 2014 - 04:00 PM

NiteLordz and I have been exchanging e-mails on this topic. With his help I've been able to update AngelScript to allow it compile and link the library successfully for Windows Phone with ARM CPU. Unfortunately we've hit a roadblock on getting the native calling conventions to work properly.

 

I've investigated some of the disassemblies from the regression test suite and I can see that the Windows Phone 8 ARM ABI is not the same as what is already implemented in the library. Some of the things I see as different from the current implementation are: the assembler routines in as_callfunc_arm_msvc.asm doesn't guarantee 8 byte alignment on the callstack and the assembler routines are not using the floating point registers when passing or returning float values. There may be other differences too, but only testing will tell.

 

To get the native calling conventions fully working it would be necessary to adapt the code written for the Linux ARM with hard float ABI to work for MSVC too, and then run the test_features regression tests to make sure everything is working. Unfortunately it is not possible to test the native calling convention code with the Windows Phone emulator that comes with the SDK, so it requires a physical Windows Phone device to do that, which I do not have. So I'm not able to progress any further at the moment.

 

Is anyone with a Windows Phone 8 and a little skill with assembler (not much is really needed) interested in giving a hand in getting this to work?


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS