Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bindings generator does not handle multiple derived types #68

Open
philipcass opened this issue Feb 21, 2021 · 3 comments
Open

Bindings generator does not handle multiple derived types #68

philipcass opened this issue Feb 21, 2021 · 3 comments
Labels

Comments

@philipcass
Copy link
Contributor

I've noticed when you have several classes based of the same abstract class the codegen can't handle it even thought the syntax looks like it should e.g.

		{
			"Name": "MyNamespace.AbstractShape",
			"BaseTypes": [
				{
					"BaseName": "MyNamespace.BaseSquare",
					"DerivedName": "MyNamespace.Square"
				},
				{
					"BaseName": "MyNamespace.BaseCircle",
					"DerivedName": "MyNamespace.Circle"
				}
			]
		}

Doesn't work

@jacksondunstan
Copy link
Owner

@philipcass Can you please elaborate on what doesn't work?

@philipcass
Copy link
Contributor Author

@jacksondunstan When generating c sharp delegates for each instance of the derived types the code-gen redeclares the common abstract methods multiple times e.g. if GetRadius was declared in AbstractShape it'd create this twice:

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate double MyNamespaceAbstractShapeGetRadiusDelegateType(int thisHandle);
		public static MyNamespaceAbstractShapeRadiusDelegateType MyNamespaceAbstractShapeGetRadiusDelegateType;

@jacksondunstan
Copy link
Owner

@philipcass Thanks for clarifying. It looks like that code should only be generated for the first derived type, not all of them. I'm not able to address the issue right away, but please do feel free to submit a PR with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants