Presentation is loading. Please wait.

Presentation is loading. Please wait.

episthmh MVP for Visual C++

Similar presentations


Presentation on theme: "episthmh MVP for Visual C++"— Presentation transcript:

1 episthmh MVP for Visual C++
4/11/2019 5:46 AM C++/CLI でつくる モナカのカワ (゚Д゚)ウマー episthmh MVP for Visual C++ © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 モナカのカワとしてのC++/CLI 既存の資産がMOTTAINAI!
4/11/2019 5:46 AM モナカのカワとしてのC++/CLI 既存の資産がMOTTAINAI! C++/CLIは既存のC/C++を呼べる C++/CLIライブラリ(DLL)は.NET規約に従う なので、.NET-lang.はC++/CLIでくるんだ C/C++ライブラリを呼べる C/C++ ライブラリ C# C++/CLI ライブラリ Visual Basic J# C++/CLI © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

3 C-ライブラリ:SQLiteに.NETのカワ
4/11/2019 5:46 AM C-ライブラリ:SQLiteに.NETのカワ C# から↓こんな感じで使いたい /* Database.exec() の結果を受け取るコールバック */ static bool print(object opt, object[] result) { TextWriter writer = (TextWriter)opt; foreach ( SQLite3.NVPair field in result) { writer.WriteLine(“{0} = {1}”, field.Name, field.Value); } return true; static void Main() { SQLite3.Database db = new SQLite3.Database(); db.open(“wankuma.db”); string errmsg; db.exec(“SELECT * FROM a_table”, // 実行するSQL print, Console.Out, // コールバックと引数 out errmsg); db.close(); public struct NVPair { public string Name; // 名前 public string Value; // 値 } © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

4 C-ライブラリ:SQLiteに.NETのカワ
4/11/2019 5:46 AM C-ライブラリ:SQLiteに.NETのカワ typedef int (*sqlite3_callback16) (void*,int,wchar_t**,wchar_t**); int sqlite3_exec16( sqlite3* db, const wchar_t* sql, sqlite3_callback16 cb, void* opt, wchar_t **errmsg); C namespace SQLite3 { public enum Result { … } public struct NVPair { string Name; string Value; } public delegate bool Callback(object opt, NVPair[] results); public class Database { public Result exec(string sql, Callback cb, object opt, out string errmsg); } C# © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

5 managedクラスはnativeなポインタを持てる!
4/11/2019 5:46 AM カワのかぶせドコロ 文字列 : string ⇔ char*, wchar_t* コールバック : delegate ⇔ 関数ポインタ 万能変数 : object ⇔ void* Public delegate bool Callback(Object^ opt…); public ref class Database { private: sqlite3* db_; public: Result exec(String^ sql, Callback^ cb, Object^ opt, [Runtime::InteropServices::Out] String^% errmsg) { /* カワをかぶせてC-関数を呼ぶ! */ } } managedクラスはnativeなポインタを持てる! C++/CLI © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

6 詳しくはココ! episthmh 翔泳社 Windows Developer Magazine 2006/9月号
4/11/2019 5:46 AM 詳しくはココ! 翔泳社 Windows Developer Magazine 2006/9月号 episthmh 「世界はオブジェクトの海に浮かぶ」 ── 第17回 : SQLiteを使ってDBプログラミング © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

7 Visual C++ ってば… Cであり、 C++であり、 C++/CLI(.NET)である C/C++ライブラリが使え、
4/11/2019 5:46 AM Visual C++ ってば… Cであり、 C++であり、 C++/CLI(.NET)である C/C++ライブラリが使え、 Win32-APIが使え、 MFCが使え、 .NET Frameworkが使える int main() { int value = 123; } printf(“%d\n”, value); cout << value << end; Console::WiteLine(“{0}”,value); ( ゚д゚)ポカーン (ノ゚∀゚)ノ アンコイパーイ © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

8 おまけ Enjoy OOPing! C テスト対象 C++/CLI テストコード NUnit (C#) 4/11/2019 5:46 AM
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "episthmh MVP for Visual C++"

Similar presentations


Ads by Google