Open sonygod opened 4 years ago
after revert master branch,still get this error
test code here
with this lib : https://github.com/ianharrigan/hxWebSockets
and MyHandler.hx is here.
https://github.com/ianharrigan/hxWebSockets/blob/master/Examples/sys-server/src/MyHandler.hx
package;
import hx.ws.WebSocketServer;
import server.MyHandler;
#if emscripten
@:buildXml("
<linker id='exe' exe='em++'>
<flag value='-s' />
<flag value='WASM=1' />
</linker>
")
@:cppFileCode('
#include <emscripten/bind.h>
using namespace emscripten;
EMSCRIPTEN_BINDINGS(my_class_example) {
class_<EMCCMain>("EMCCMain")
.class_function("sum", &EMCCMain_obj::Sum)
.class_function("fb", &EMCCMain_obj::Fb)
.class_function("fb2", &EMCCMain_obj::Fb2);
}
')
#end
/**
* wasm example.
*/
class EMCCMain {
public static function Fb(n:Int) {
if (n == 0) {
return 0;
}
if (n == 1) {
return 1;
}
return Fb(n - 1) + Fb(n - 2);
}
public static function Fb2(first:Float, second:Float, n:Int):Float {
if (n < 2) {
return n;
}
if (n == 2) {
return first + second;
}
var result = Fb2(second, first + second, n - 1);
// trace('first=$first second=$second ,n=$n result=$result');
return result;
}
public static function Sum(a:Int, b:Int):Int {
return a + b;
}
public static function main() {
trace("hello wasm1");
var port = 9007;
var server = new WebSocketServer<MyHandler>("0.0.0.0", port, 30);
trace("server ready start " + port);
server.start();
}
}
Information: C:/HaxeToolkit/haxe/lib/hxcpp/4,0,64/src/hx/libs/std/Sys.cpp:174:14: error: use of undeclared identifier '_wsetlocale'; did you mean 'setlocale'? Information: return _wsetlocale(LC_TIME,l.wchar_str()); Information: C:\emsdk\upstream\emscripten\system\include\libc\locale.h:53:7: note: 'setlocale' declared here Information: char setlocale (int, const char ); Information: C:/HaxeToolkit/haxe/lib/hxcpp/4,0,64/src/hx/libs/std/Sys.cpp:174:34: error: cannot initialize a parameter of type 'const char ' with an rvalue of type 'const wchar_t ' Information: C:\emsdk\upstream\emscripten\system\include\libc\locale.h:53:35: note: passing argument to parameter here
Same Issue
Duplicate of #867
build with emcc
got this error.