Created
May 29, 2013 09:01
-
-
Save alistra/5668955 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <emscripten/bind.h> | |
using namespace emscripten; | |
using namespace std; | |
struct Ssss { | |
char *c; | |
int x; | |
}; | |
EMSCRIPTEN_BINDINGS(my_value_example) { | |
value_struct<Ssss>("Ssss") | |
.field("c", &Ssss::c) | |
.field("x", &Ssss::x) | |
; | |
} | |
//the error: | |
/Users/aleksander/emscripten/system/include/emscripten/wire.h:41:13: error: static_assert failed "Implicitly binding raw pointers is illegal. Specify allow_raw_pointer<arg<?>>" | |
static_assert(!std::is_pointer<T*>::value, "Implicitly binding raw pointers is illegal. Specify allow_raw_pointer<arg<?>>"); | |
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
/Users/aleksander/emscripten/system/include/emscripten/bind.h:625:17: note: in instantiation of template class 'emscripten::internal::TypeID<char *>' requested here | |
TypeID<FieldType>::get(), | |
^ | |
bindings.cpp:49:14: note: in instantiation of function template specialization 'emscripten::value_struct<Ssss>::field<Ssss, char *>' requested here | |
.field("c", &Ssss::c) | |
^ | |
In file included from bindings.cpp:1: | |
/Users/aleksander/emscripten/system/include/emscripten/bind.h:625:34: error: incomplete definition of type 'emscripten::internal::TypeID<char *>' | |
TypeID<FieldType>::get(), | |
~~~~~~~~~~~~~~~~~^~ | |
bindings.cpp:49:14: note: in instantiation of function template specialization 'emscripten::value_struct<Ssss>::field<Ssss, char *>' requested here | |
.field("c", &Ssss::c) | |
^ | |
2 errors generated. | |
ERROR emcc: compiler frontend failed to generate LLVM bitcode, halting | |
//when I add allow_raw_pointers() | |
struct Ssss { | |
char *c; | |
int x; | |
}; | |
EMSCRIPTEN_BINDINGS(my_value_example) { | |
value_struct<Ssss>("Ssss") | |
.field("c", &Ssss::c, allow_raw_pointers()) | |
.field("x", &Ssss::x) | |
; | |
} | |
// error: | |
/Users/aleksander/emscripten/system/include/emscripten/bind.h:650:33: error: implicit instantiation of undefined template 'emscripten::internal::GetterPolicy<char *Ssss::*>' | |
TypeID<typename GP::ReturnType>::get(), | |
^ | |
bindings.cpp:49:14: note: in instantiation of function template specialization 'emscripten::value_struct<Ssss>::field<char *Ssss::*, emscripten::allow_raw_pointers>' requested here | |
.field("c", &Ssss::c, allow_raw_pointers()) | |
^ | |
/Users/aleksander/emscripten/system/include/emscripten/bind.h:426:16: note: template is declared here | |
struct GetterPolicy; | |
^ | |
1 error generated. | |
ERROR emcc: compiler frontend failed to generate LLVM bitcode, halting |
no idea bro it was for a job interview 9 years ago
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you solved this problem?
I found this: https://gist.github.com/AlexPerrot/5d8a3aa0eacf7f3de5478ec1164c834e