Godot: ResourceLoader change breaks GDnative

Created on 15 Jan 2019  路  4Comments  路  Source: godotengine/godot

Godot version: 3.1 beta (commit 9ed34d44238d130f5c7d999bb7265e7c0e906567)
OS/device including version: Gentoo Linux 4.14.65, KDE 5 Plasma, NVidia w/proprietary drivers

Issue description:
You recently exported the method handles_type of the ResourceFormatLoader with a parameter named typename.

https://github.com/godotengine/godot/blob/9ed34d44238d130f5c7d999bb7265e7c0e906567/core/io/resource_loader.cpp#L247

This compiles cleanly in Godot because typename is only contained in a string, but when creating GDnative bindings, the wrapper function actually uses typename (a reserved C++ keyword) as the parameter name:

In file included from include/gen/ResourceFormatLoaderVideoStreamGDNative.hpp:11:0, from src/gen/ResourceFormatLoaderVideoStreamGDNative.cpp:1: include/gen/ResourceFormatLoader.hpp:31:41: error: expected nested-name-specifier before ')' token bool handles_type(const String typename);

Steps to reproduce:

  1. Compile latest Godot source code,
  2. Update scripting API definition w/--gdnative-generate-json-api godot-cpp/godot_headers/api.json
  3. Try to compile godot-cpp
archived bug gdnative

Most helpful comment

Confirmed, have same error, temporairly fixed, by manually editing api.json after generating and changing typename -> type_name

All 4 comments

CC @Zylann @karroffel @BastiaanOlij

That is a problem in the generation of the C++ bindings, there are several names used in the Godot API that are invalid C++ identifiers, so it has to be remapped to a different name (like _typename)

Confirmed, have same error, temporairly fixed, by manually editing api.json after generating and changing typename -> type_name

Closing as duplicate of GodotNativeTools/godot-cpp#228.

Was this page helpful?
0 / 5 - 0 ratings