Hello everybody.
I need to create a javascript script that uses a C++ plugin. And I can’t see the way to do that.
I’ve done it in C# with [DllImport ("PluginName")]
But I don’t know how to do that in javascript.
Anyone can help me?
Thank you in advance
The syntax in javascript for attributes is a bit different:
@DllImport ("PluginName")
… although I haven’t tried to access C++ plugins from JavaScript.
And how sould I do In Javascript the
private static extern float FooPluginFunction ();
Thanks again!
Not sure about the “extern” keyword, but the rest should be:
private static extern function FooPluginFunction () : float;
… but why do you need to use JavaScript to define the interface? Even if you use C#, the functions will be accessible from JavaScript (and Boo as well)
Thank you!
It’s because I started using Javascript files and now I’ve crossed dependences between C# files that must be compiled before and C# that must be compiled after the js files.
Thank you again!
The code you gave me does not work.
I’ve tried with and without the “extern” keword.
With “extern” tell me " expecting function, found ‘extern’"
And Without :
“expecting {, found ‘;’.”
Sorry and thank you!
It seems Javascript doesn’t support the syntax required to define external methods. I guess you’ll have to use C# then