Skip to content
This repository was archived by the owner on Jan 28, 2024. It is now read-only.

Added wrapper over lookUpbindings, fixed merge conflicts, migrated code #25

Merged
merged 5 commits into from
Jul 10, 2020
Merged

Added wrapper over lookUpbindings, fixed merge conflicts, migrated code #25

merged 5 commits into from
Jul 10, 2020

Conversation

mannprerak2
Copy link
Contributor

Closes dart-lang/native#532.

A wrapper is now generated for the bindings which need to look-up symbols from dynamic library.

  • Replaced config init-function-name with wrapper-name.
  • Handled name conflicts - Function-Function, Typedef - Function - Struct/Enum.
  • Updated examples and clang_bindings, Updated tests.

@mannprerak2 mannprerak2 requested a review from dcharkes July 8, 2020 18:42
Copy link
Contributor

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this.

We should use proper naming for the class we generate:

Clang clang; // Not called Bindings.
clang.clang_CXIndex_getGlobalOptions(...);

Or you want to go one step further, you could even think about using the prefix name replacer to remove the clang_ from the method names:

Clang clang;
clang.CXIndex_getGlobalOptions(...);

(Not for this PR, I just wanted to show that this feature is nice!)

}

/// Parses source files and adds generated bindings to [bindings].
List<Binding> parseToBindings() {
final index = clang.clang_createIndex(0, 0);
final index = data.bindings.clang_createIndex(0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data.bindings -> clang (import the name into here without a name).
clang -> clangTypes (change the import name).

That way both are related. Here, and everywhere else in the code.

It is kind of a pity that Dart does not have nested classes (dart-lang/language#336 and dart-lang/language#1049), as then we could have both as clang.functionCall and Clang.Type.

@eernstg Any other language features which might be handy in this situation?

@mannprerak2 mannprerak2 requested a review from dcharkes July 10, 2020 10:32
@mannprerak2 mannprerak2 requested a review from dcharkes July 10, 2020 11:08
@dcharkes dcharkes merged commit acef4b4 into dart-archive:master Jul 10, 2020
@mannprerak2 mannprerak2 deleted the functions_wrapper branch July 10, 2020 11:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Loading multiple dynamic libraries with the same bindings
2 participants