Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Importing jslib in javascript with @DllImport : get "EntryPointNotFoundException" error message

Discussion in 'Scripting' started by ornicar, Jan 5, 2016.

  1. ornicar

    ornicar

    Joined:
    Mar 17, 2015
    Posts:
    6
    Hi,

    I'm trying to call JavaScript functions from a jslib plugin for a WebGL build as described there:

    http://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

    I just copied the sample jslib file to my Assets/Plugins/WebGL folder

    Then I import the first function ( Hello ) using JavaScript :

    @DllImport ("__Internal") private static function Hello() {};

    That seems ok but then, if I later invoke Hello(), I get an "EntryPointNotFoundException: Hello" message.

    I have tried moving the files in different folders and I have set the import setting of the jslib plugin to "Any platform" but with no success.

    Any idea, someone ?
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,744
    I don't have any experience in this specific area, but I noticed your line of code omits the "extern" keyword as seen in the example. That seems important?
     
  3. ornicar

    ornicar

    Joined:
    Mar 17, 2015
    Posts:
    6
    Could be.

    But the sample code is in C# ; I write in JavaScript and "extern" is not a token recognized by Unity's compilator.

    Maybe there is a equivalent in JS of this "extern" token. I found most of the documentation on the subject to be in C#.

    That could be the cause of the problem, indeed. Does anyone know about that ?
     
  4. ornicar

    ornicar

    Joined:
    Mar 17, 2015
    Posts:
    6
    In other words, does anybody know how to call, in JavaScript, a function that is in a jslib file, as described in the link in my first post (but in Javascript)

    Thank you.
     
  5. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    241
    Last edited: Apr 1, 2016
    Nodrap and Deleted User like this.
  6. ebubeud1996

    ebubeud1996

    Joined:
    Mar 31, 2018
    Posts:
    6