Allow embind to benefit from the EXPORT_FUNCTION_TABLES option.

This commit is contained in:
Chad Austin 2014-11-14 22:43:46 -08:00
Родитель a563da7adc
Коммит 5a3ae46c88
2 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -1288,6 +1288,8 @@ return real_''' + s + '''.apply(null, arguments);
if settings['EXPORT_FUNCTION_TABLES']:
receiving += '\n'
for table in last_forwarded_json['Functions']['tables'].values():
tableName = table.split()[1]
table = table.replace('var ' + tableName, 'var ' + tableName + ' = Module["' + tableName + '"]')
receiving += table + '\n'
# finalize

Просмотреть файл

@ -917,8 +917,11 @@ var LibraryEmbind = {
}
var fp;
// asm.js does not define FUNCTION_TABLE
if (typeof FUNCTION_TABLE === "undefined") {
if (Module['FUNCTION_TABLE_' + signature] !== undefined) {
fp = Module['FUNCTION_TABLE_' + signature][rawFunction];
} else if (typeof FUNCTION_TABLE !== "undefined") {
fp = FUNCTION_TABLE[rawFunction];
} else {
// asm.js does not give direct access to the function tables,
// and thus we must go through the dynCall interface which allows
// calling into a signature's function table by pointer value.
@ -940,8 +943,6 @@ var LibraryEmbind = {
}
}
fp = makeDynCaller(dc);
} else {
fp = FUNCTION_TABLE[rawFunction];
}
if (typeof fp !== "function") {