-
Notifications
You must be signed in to change notification settings - Fork 0
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
extern
の実装
#40
Labels
enhancement
New feature or request
Comments
メモ
|
.Net側の名前空間も宣言する必要があるなぁ #[link(name = "System.Console.dll")]
extern {
mod System {
struct Console {}
impl Console {
fn WriteLine(_: string) {}
}
}
}
fn main() {
System::Console::WriteLine("ok");
} |
こうすると NameSpaceをマージする機能が欲しい。 #[link(name = "System.Console.dll")]
extern {
mod System {
struct Console {}
impl Console {
fn WriteLine(_: string) {}
}
}
}
#[link(name = "System.Windows.Forms.dll")]
extern {
mod System {
mod Windows {
mod Forms {
struct DialogResult {}
struct MessageBox {}
impl MessageBox {
fn Show(text: string) -> DialogResult {}
}
}
}
}
}
fn main() {
System::Windows::Forms::MessageBox::Show("hello!");
System::Console::WriteLine("ok");
println!("ok");
} |
#[link(name = "System.Drawing.Primitives.dll")]
extern {
mod System {
mod Drawing {
struct Size {
Width: i32,
Height: i32,
}
impl Size {
fn .ctor(width: i32, height: i32) -> Size {}
}
}
}
}
fn main() {
let s: System::Drawing::Size = System::Drawing::Size::.ctor(2, 3);
assert_eq!(s.Width == 2 && s.Height == 3);
} |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
言語としては物凄く面倒くさい仕様になってしまうが、最終的に外部crateとしてこの部分(System名前空間)を提供すれば使いやすくなるのではないか。
Tasks
to_ilstr
でアセンブリ参照と完全パス名を生成できるように.assembly extern System.Console {}
)-> extern宣言で
publickeytokenも定義させて、それを元に生成...?
The text was updated successfully, but these errors were encountered: