Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Problem with dynamic Type

0
0
Hi furesoft,

First of all, wow, that is some interesting code! A dynamic class for invoking native methods? Very clever.

Unfortunately, there are a few issues:
  • In the above, the variable c is undefined because JavaScript statements (var in this case) don't have results. If you remove "var", you'll have an assignment expression, which has a result and is probably what you want.
  • At line 54 your class uses reflection to retrieve a private field from the binder. ClearScript's binder doesn't have a field with that name. As written, the code probably works only with a specific binder implementation.
  • DynamicDllImportMetaObject needs to provide an appropriate override for DynamicMetaObject.GetDynamicMemberNames(). JavaScript-style method invocation cannot work without it. Unfortunately there's no .NET API for enumerating native DLL exports.
  • Finally, there's a subtle bug in ClearScript that would prevent this from working even if all the other issues were resolved. We'll fix that ASAP.
Good luck!

Viewing all articles
Browse latest Browse all 2297