# Compiling SWIPlCs with Unity WebGL

**URL:** <https://swi-prolog.discourse.group/t/compiling-swiplcs-with-unity-webgl/3836>\
**Category:** Predicate\
**Tags:** how-to\
**Created:** [April 19, 2021, 8:28am UTC](https://swi-prolog.discourse.group/t/compiling-swiplcs-with-unity-webgl/3836 "2021-04-19T08:28:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sis](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@Sis](https://swi-prolog.discourse.group/u/Sis)\
**Post date:** [April 19, 2021, 8:28am UTC](https://swi-prolog.discourse.group/t/compiling-swiplcs-with-unity-webgl/3836/1 "2021-04-19T08:28:02Z")

</div>

Hello everyone,

I am using SWI-Prolog with Unity3D with the [SWIPLCS](https://github.com/SWI-Prolog/contrib-swiplcs) interface and have been able to successfully interact with the swipl engine from my C# scripts.

However, the interaction is working inside the Unity3D Editor as well as when I compile my project (i.e. my game) for Windows (using the Mono compiler) but not when I compile my project for WebGL (using the Il2CPP compiler). In the last case, I get the following errors :

```prolog
Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:7917:9: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    __this->set__ uintptr_0(L_0);
                    ~~~~~~^~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:7932:21: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    uint64_t L_1 = L_0.get__uintptr_0();
                                   ~~~^~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:7944:25: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    uint64_t* L_0 = __this->get_address_of__ uintptr_0();
                                    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:8017:21: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    uint64_t L_1 = L_0.get__uintptr_0();
                                   ~~~^~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:8019:21: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    uint64_t L_3 = L_2.get__uintptr_0();
                                   ~~~^~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:8028:21: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    uint64_t L_1 = L_0.get__uintptr_0();
                                   ~~~^~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:8049:21: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    uint64_t L_1 = L_0.get__uintptr_0();
                                   ~~~^~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:8059:21: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    uint64_t L_1 = L_0.get__uintptr_0();
                                   ~~~^~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:8071:9: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    (&V_0)->set__uintptr_0(L_0);
                    ~~~~~~^~~~~~~~~~~~~~~
    C:\Users\sylva\Seafile\phd_limos\work\unity\wumpus_world\Library\Il2cppBuildCache\WebGL\il2cppOutput\SwiPlCs.cpp:8413:9: error: member reference base type 'uintptr_t' (aka 'unsigned long') is not a structure or union
                    __this->set__ uintptr_0(L_0);
                    ~~~~~~^~~~~~~~~~~~~~~
    10 errors generated.
    ERROR:root:compiler frontend failed to generate LLVM bitcode, halting

```

From what I have understood, the compiler has issues translating the C++ code from the SWIPLCS interface.

Any idea how to solve this? Thanks
