简体   繁体   English

在C ++中嵌入GWT?

[英]Embed GWT in C++?

I want to write code in java, compile with GWT and embed output JavaScript into C++ program via v8. 我想用Java编写代码,用GWT编译,然后通过v8将输出JavaScript嵌入到C ++程序中。 Everything seems logical and thus possible. 一切似乎合乎逻辑,因此可能。 I didn't use GWT before, so i'm not sure. 我以前没有使用过GWT,所以不确定。 Maybe someone knows whether it's possible? 也许有人知道这是否可能?

You can copy JavaScript code from GWT output, you only need set the type of obfuscation to PRETTY or DETAILED with "-style" flag of compiler (for better reading). 您可以从GWT输出中复制JavaScript代码,只需要使用编译器的“ -style”标志将混淆类型设置为PRETTY或Detailed(以便更好地阅读)。 You can read more here about code obfuscation in GWT 您可以在此处阅读有关GWT中代码混淆的更多信息

Of course you can, like others have used GWT to produce js run in chrome and ff plugins etc. 当然,您可以像其他人一样,使用GWT生成在chrome和ff插件等中运行的js。

Think that gwt core is just a compiler, it gets java code and produces js. 认为gwt core只是一个编译器,它获取Java代码并生成js。

What you need to have in mind: 您需要记住的是:

First is that after compiling, gwt utilizes linkers to wrap the result code in .js or .html files specific to the way that js would be executed, so proly you would have to write a linker (or modify an existing one) to deliver the js code in the way you need. 首先是在编译后,gwt利用链接器将结果代码包装在特定于js执行方式的.js或.html文件中,因此请务必编写一个链接器(或修改现有的链接器)以交付js代码以您需要的方式进行。

And second, gwt uses browser implementations for certain things, so maybe you have to select which permutations is more suitable for v8, and perhaps tweak some implementations. 其次,gwt使用浏览器实现某些功能,因此也许您必须选择哪个排列更适合v8,并可能需要调整一些实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM