digitalmars.D.learn - Headers, segfaults and other pains part II
- Oliver (37/37) May 18 2005 1. app = app_new_app(cast(int)args.length, cast(char*[])args);
1. app = app_new_app(cast(int)args.length, cast(char*[])args); Here, I have to convert the argument char[][] args to char*[] because the function expects a char*[]. I feel the way I am doing it is wrong. 2. app_on_window_redraw(w, cast(WindowDrawFunc)&draw_ellipses); here , WindowDrawFunc is defined in app.d as typedef void (*WindowDrawFunc) (Window *w, Graphics *g); and draw_ellipses is a function that fits this type, but still I had to convert it because the compiler complained. When I run the compiler like above I get ellipses.o(.data+0x30): undefined reference to `_ModuleInfo_3app' ellipses.o(.data+0x34): undefined reference to `_ModuleInfo_8app_help' ellipses.o(.gnu.linkonce.t_D8ellipses13draw_ellipsesF.... In function `_D8ellipses13draw_ellipsesFPS3app6WindowPS3app8GraphicsZv': : undefined reference to `_D8app_help4rectFiiiiZS3app4Rect' ellipses.o(.gnu.linkonce.t_Dmain+0x4b): In function `_Dmain': : undefined reference to `_D8app_help4rectFiiiiZS3app4Rect' collect2: ld returned 1 exit status however, when I use dmd ellipses.d app_help.d app.d -L-lapp -L-lglib -L-lX11 It compiles : gcc ellipses.o app_help.o app.o -o ellipses -lphobos -lpthread -lm -Xlinker -lapp -Xlinker -lglib -Xlinker -lX11 And I get an executable ellipse. Running it results in : bash-2.05b$ ./ellipses Segmentation fault When I use dmd ellipses.d app_help.d -L-lapp -L-lglib -L-lX11 I get ellipses.o(.data+0x30): undefined reference to `_ModuleInfo_3app' app_help.o(.data+0x30): undefined reference to `_ModuleInfo_3app' collect2: ld returned 1 exit status I really depend on u people to get this working. I would love to use D. The graphapp lib is really nice and should be easy to convert. Maybe there is a skilled D-hacker who wants to spent some minutes on converting the header ? It would be a great input for the community (A lightweight C-stile API for GUIS and image loading/saving manipulation) Regards, Oliver
May 18 2005