문제

I am trying to get the Dart native extension example from this page to work.

http://www.dartlang.org/articles/native-extensions-for-standalone-dart-vm/

I am on Windows. I downloaded and extracted dart to C:\Program Files\dart

I checked out dartsSVN into C:\Projects\dartSVN so I can get the sample_extention project but when I open it the analyzer throws these problems:

"Target of URI does not exist: 'dart-ext:sample_extension'"

and

"Native functions can only be declared in the SDK and code that is loaded through native extensions"

and when i try to run it i get

"cannot find extension library 'file:///C:/Projects/Dart/sample_extension/bin/sample_synchronous_extension.dart': Error: line 7 pos 1: library handler failed import 'dart-ext:sample_extension';

'file:///C:/Projects/Dart/sample_extension/bin/test_sample_synchronous_extension.dart': Error: line 7 pos 1: library handler failed import 'sample_synchronous_extension.dart';"

What am I doing wrong?

도움이 되었습니까?

해결책

You can ignore analyzer error this time. It seems like a bug/issue with current Dart version.

The error "cannot find extension library... means that Dart VM can not find the "sample_extension.dll" file inside your project folder. You must compile the C++ source code of the sample by yourself to generate the library (dll under Windows).

The article about native extensions has a section called Building on Windows. Just follow the instructions.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top