# AngelScript on WindowsRT

This topic is 662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites

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.

##### Share on other sites

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.

##### Share on other sites

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

##### Share on other sites

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?

##### Share on other sites

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... ?

##### Share on other sites

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)  #### Share this post ##### Link to post ##### Share on other sites 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 #### Share this post ##### Link to post ##### Share on other sites 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. #### Share this post ##### Link to post ##### Share on other sites I have attached the project file that you requested. #### Share this post ##### Link to post ##### Share on other sites 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).

##### Share on other sites

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.

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.

##### Share on other sites

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?

##### Share on other sites

MSVS SLN with my commits. Work perfect with vc10-vc14 hire

VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
If you needed Express Edition version of SLN write issue on github.

I join any kinds of pull request

##### Share on other sites

Hi cmd.exe,

I would like to take a look at the changes you've done to incorporate them into the official repository. But unfortunately your link doesn't appear to be working.

##### Share on other sites

This topic is 662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628653
• Total Posts
2984052

• 10
• 9
• 9
• 10
• 21