ページへ戻る

− Links

 印刷 

VC++ONosa_dir2 のバックアップの現在との差分(No.5) :: OSASK計画

osaskwiki:VC++ONosa_dir2 のバックアップの現在との差分(No.5)

« Prev[4]  Next »[5]
5: 2004-10-04 (月) 19:16:54 ソース[6] 現: 2024-01-08 (月) 12:58:51 ゲスト ソース[7]
Line 87: Line 87:
 /* "helloc4.cpp":helloをC++言語で記述した例 */  /* "helloc4.cpp":helloをC++言語で記述した例 */
 /*  stack:4k malloc:1k */  /*  stack:4k malloc:1k */
 + 
 /* このソースの説明が"helloc4.txt"に書かれています */  /* このソースの説明が"helloc4.txt"に書かれています */
 + 
 extern "C" {  extern "C" {
 #include <guigui00.h>  #include <guigui00.h>
 void OsaskMain();  void OsaskMain();
 }  }
 + 
 #define  AUTO_MALLOC  0  #define  AUTO_MALLOC  0
 + 
 class helloc4 {  class helloc4 {
 public:  public:
Line 102: Line 102:
   ~helloc4();    ~helloc4();
 };  };
 + 
 helloc4::helloc4() {  helloc4::helloc4() {
   struct LIB_WINDOW *window;    struct LIB_WINDOW *window;
   struct LIB_TEXTBOX *wintitle, *textbox;    struct LIB_TEXTBOX *wintitle, *textbox;
 + 
   /* ライブラリの初期化(必ず最初にやらなければならない) */    /* ライブラリの初期化(必ず最初にやらなければならない) */
   lib_init(AUTO_MALLOC);    lib_init(AUTO_MALLOC);
 + 
   /* ウィンドウのオープン */    /* ウィンドウのオープン */
   window = lib_openwindow(AUTO_MALLOC, 0x0200, 136, 48);    window = lib_openwindow(AUTO_MALLOC, 0x0200, 136, 48);
 + 
   /* ウィンドウタイトル用のテキストボックスをオープン */    /* ウィンドウタイトル用のテキストボックスをオープン */
   wintitle = lib_opentextbox(0x1000, AUTO_MALLOC, 0,  7, 1,  0,  0, window, 0x00c0, 0);    wintitle = lib_opentextbox(0x1000, AUTO_MALLOC, 0,  7, 1,  0,  0, window, 0x00c0, 0);
 + 
   /* "hello, world"を表示するためのテキストボックスをオープン */    /* "hello, world"を表示するためのテキストボックスをオープン */
   textbox  = lib_opentextbox(0x0000, AUTO_MALLOC, 0, 12, 1, 16, 16, window, 0x00c0, 0);    textbox  = lib_opentextbox(0x0000, AUTO_MALLOC, 0, 12, 1, 16, 16, window, 0x00c0, 0);
 + 
   /* ウィンドウタイトルを表示 */    /* ウィンドウタイトルを表示 */
   lib_putstring_ASCII(0x0000, 0, 0, wintitle, 0, 0, "helloc4");    lib_putstring_ASCII(0x0000, 0, 0, wintitle, 0, 0, "helloc4");
 + 
   /* メッセージを表示 */    /* メッセージを表示 */
   lib_putstring_ASCII(0x0000, 0, 0, textbox,  0, 0, "hello, world");    lib_putstring_ASCII(0x0000, 0, 0, textbox,  0, 0, "hello, world");
 + 
   /* 終了 */    /* 終了 */
   lib_waitsignal(0x0001, 0, 0);    lib_waitsignal(0x0001, 0, 0);
 }  }
 + 
 helloc4::~helloc4(){}  helloc4::~helloc4(){}
 + 
 void OsaskMain()  void OsaskMain()
 {  {
Line 140: Line 140:
-やっぱVC++は不便な点が多いので、GOがバージョンアップしてC++の不具合が無くなるのを期待。 -- ''uchan'' SIZE(10){2004-10-03 (日) 17:01:06} -やっぱVC++は不便な点が多いので、GOがバージョンアップしてC++の不具合が無くなるのを期待。 -- ''uchan'' SIZE(10){2004-10-03 (日) 17:01:06}
-ライブラリ出来ました。VCにパスを通し、CL = cl.exe -I$(INCPATH) -c としました。 -- ''uchan'' SIZE(10){2004-10-04 (月) 07:16:28} -ライブラリ出来ました。VCにパスを通し、CL = cl.exe -I$(INCPATH) -c としました。 -- ''uchan'' SIZE(10){2004-10-04 (月) 07:16:28}
 +-ものぐさな人に必要な処置を施したosa_dir2改をあげておきます。http://bayside.upper.jp/upload/osasksdk-20041005.lzh -- ''bayside'' SIZE(10){2004-10-05 (火) 22:01:17}
 +-obj2bim3で"Warning : can't link ??2@YAPAXI@Z"が発生。どうもnewがリンクできていないらしい。 -- ''bayside'' SIZE(10){2004-10-06 (水) 15:17:52}
 +-つまりnew演算子用のランタイムがVCにあって、それが無いからリンクできないのでしょう。おそらくランタイムはOSに依存するので、VCのランタイムから持ってくるだけでは解決できないと思います。 -- [[K]] SIZE(10){2004-10-06 (水) 15:58:27}
 +-inline void* operator new(size_t n){ return malloc(n); } でたいていの環境でnewが使えるようになるはづ。 -- [[名無しさん]] SIZE(10){2004-10-06 (水) 17:28:47}
#comment #comment
« Prev[4]  Next »[5]