Problem exposing win32 commands in BMX NG
BlitzMax Forums/BlitzMax Programming/Problem exposing win32 commands in BMX NG
| ||
I am trying to use the DrawTextW function in Blitzmax NG. I get this error when I add the function delcaration to gdi32.bmx:In file included from C:/BlitzMaxNG/mod/pub.mod/win32.mod/.bmx/gdi32.bmx.debug.win32.x86.c:1:0: C:/BlitzMaxNG/mod/pub.mod/win32.mod/.bmx/gdi32.bmx.debug.win32.x86.h:263:14: error: conflicting types for 'DrawTextW' extern BBINT DrawTextW(BBINT bbt_hdc,BBSHORT * bbt_lpString,BBINT bbt_nCount,BBINT* bbt_lpRect,BBINT bbt_uFormat); ^ In file included from c:\blitzmaxng\mingw32\x86_64-w64-mingw32\include\windows.h:72:0, from C:/BlitzMaxNG/mod/brl.mod/blitz.mod/blitz_thread.h:7, from C:/BlitzMaxNG/mod/brl.mod/blitz.mod/blitz.h:28, from C:/BlitzMaxNG/mod/brl.mod/blitz.mod/.bmx/blitz.bmx.debug.win32.x86.h:4, from C:/BlitzMaxNG/mod/pub.mod/win32.mod/.bmx/gdi32.bmx.debug.win32.x86.h:4, from C:/BlitzMaxNG/mod/pub.mod/win32.mod/.bmx/gdi32.bmx.debug.win32.x86.c:1: c:\blitzmaxng\mingw32\x86_64-w64-mingw32\include\winuser.h:2791:25: note: previous declaration of 'DrawTextW' was here WINUSERAPI int WINAPI DrawTextW(HDC hdc,LPCWSTR lpchText,int cchText,LPRECT lprc,UINT format); ^ Build Error: failed to compile (1) C:/BlitzMaxNG/mod/pub.mod/win32.mod/.bmx/gdi32.bmx.debug.win32.x86.c Process complete If I don't declare the function I get an "identifier not found" error. How can I get this working? |
| ||
Create an .x-file for the module check for examples: blitz.mod/blitz.x reflection.mod/reflection.x They contain the function definition of the thing you declare again. bye Ron |
| ||
So you're saying I need to watch the X-Files? |
| ||
Just execute$ mulder xfile > win32.x Seriously: create a modulename.x within the module.mod-folder and the content should be equally done to the ones I listed in my prior post. For example "reflection.mod/reflection.x" BBObject * bbObjectNew(BBClass *)! BBClass** bbObjectRegisteredTypes(int *)! BBInterface** bbObjectRegisteredInterfaces(int *)! BBArray* bbArrayNew1D(const char *,int )! Let's see what's up with that "bbObjectRegisteredInterfaces". Having a quick look at all files within brl.mod returns this: blitz.mod/blitz_object.c BBInterface **bbObjectRegisteredInterfaces( int *count ){ blitz.mod/blitz_object.h BBInterface **bbObjectRegisteredInterfaces( int *count ); reflection.mod/reflection.bmx Function bbObjectRegisteredInterfaces:Int Ptr( count Var ) Function bbObjectRegisteredInterfaces:Long Ptr( count Var ) Local p:Int Ptr Ptr=bbObjectRegisteredInterfaces( count ) Local p:Long Ptr Ptr=bbObjectRegisteredInterfaces( count ) and of course our reflection.mod/reflection.bmx BBInterface** bbObjectRegisteredInterfaces(int *)! Of interest are the function definitions ...reflection.bmx redefines the functions, and to avoid the error we have to state this in the x-file (in the way of the original ".h"-file) Another example is "pub.mod/glew.mod" (for NG): glew.bmx: Global glCopyTexSubImage3D(target_:Int,level_:Int,xoffset_:Int,yoffset_:Int,zoffset_:Int,x_:Int,y_:Int,width_:Int,height_:Int)="__glewCopyTexSubImage3D" glew.x BBINT __glewCopyTexSubImage3D(BBINT,BBINT,BBINT,BBINT,BBINT,BBINT,BBINT,BBINT,BBINT)! In your case you might need something in the lines of (untested) BBINT DrawTextW(BBINT,BBSHORT *,BBINT, BBINT*,BBINT)! bye Ron |
| ||
Cool that works. All those little classes in the Windows API are really a nightmare. |
| ||
Hey, welcome back Derron! |