Page 1 of 1

availability of C# api

Posted: 18 Apr 2014, 18:33
by TomSmith
Hi,
Apologies if this has been asked before, a quick search of the forums didn't turn anything up. As far as I understand things, you have developed a C# wrapper for noesis in order to support unity game engine. Is there any way to use this outside of unity? as in a normal C# app running noesis gui to render xaml.

Re: availability of C# api

Posted: 19 Apr 2014, 17:00
by jsantos
hi Tom,

We are working on it, but for now, it is not officially supported. You can find the latest c# layer for unity here:

http://www.noesisengine.com/NoesisGUI/MonoAPI.zip

There are two directories inside, Proxies with the API for all the framework classes and Core that is a Unity-C# layer. The second folder is the one that must be rewritten to eliminate dependencies to Unity and expose an API similar to the one described in this integration tutorial.

I think that it is an easy task if you have done this in the past for other libraries.

Re: availability of C# api

Posted: 18 Jun 2014, 03:07
by TomSmith
Its been a long time since I asked this question, but seeing someone else post about c# support made me remember I should probably have written up my results. I extracted the unitypackage using unity-3d-package-extract, then used the dll files and c# code inside to build a quick prototype by stripping out all the unity specific bits, but keeping the swig wrapper dll/proxies. (I am defining UNITY_EDITOR during build) Whilst I could get things compiling, whenever I called Noesis_Init() I would get an access violation in BindEvent_Timeline_Completed.

The only thing I couldn't easily verify was the path parameters to Noesis_init, as I don't have a copy of unity pro handy to experiment with. Assuming that the unitypackage is extracted to C:/Assets, I was using

var dataPath = "c:/Assets";
var streamingAssetsPath = dataPath + "/StreamingAssets";
int deviceType = Noesis_Init(streamingAssetsPath, dataPath + "/Plugins");


error I kept getting was:
Unhandled exception at 0x059B5813: Access Violation reading location 0x0000007C
[ 0] [0x059B5813] Noesis.dll!NsSafeDealloc + 0x3b23 bytes
[ 1] [0x059B59DE] Noesis.dll!NsSafeDealloc + 0x3cee bytes
[ 2] [0x059B1AD2] Noesis.dll!NsAlloc + 0x12 bytes
[ 3] [0x059A23BC] Noesis.dll!Noesis::Core::ConfigValuePointer::ConfigValuePointer + 0xfc bytes
[ 4] [0x059A80A4] Noesis.dll!Noesis::Core::Dll::GetCurrentModulePath + 0x124 bytes
[ 5] [0x059A8123] Noesis.dll!Noesis::Core::Dll::Load + 0x53 bytes
[ 6] [0x05DDFC0A] Noesis.dll!BindEvent_Timeline_Completed + 0x13a bytes

I have attached the associated minidump.

This occurs during the call to Noesis_Init, i am not calling BindEvent_Timeline_Completed myself, I assume Noesis_Init is doing a few more things under the hood then just calling NsGetKernel->Init(). As this is internal to the swig wrapper dll, and i couldn't figure an easy way to call NsGetKernel->Init() myself, I came to the conclusion that I would have to redo the swig wrapper to solve this, and don't really have the time to figure that out right now.

I appreciate this is currently an unsupported approach, so I am not really expecting much help with this, just wanted to write things up in case it saves anyone else some experimenting time.

Re: availability of C# api

Posted: 18 Jun 2014, 08:27
by jsantos
Thanks for sharing Tom!

We have a small project already working that we expect to release very soon. :)

Re: availability of C# api

Posted: 18 Jun 2014, 08:28
by jsantos
One of the problems you probably have is that you have to use the DLL provided inside the Unity package, in the Editor folder. Not the one that can be found in the C++ one.

Re: availability of C# api

Posted: 18 Jun 2014, 12:34
by TomSmith
yeah, I had to use the editor dll as the C++ one only has mangled names in the export, I assumed that the editor dll was just a autogenerated swig wrapper around the C++ dll, but obviously more is going on inside it, if a release is coming I will just stick this on the back burner for a while, thanks for letting me know.