Author Topic: const char errors  (Read 223 times)

jcfuller

  • Full Member
  • ***
  • Posts: 167
    • View Profile
const char errors
« on: July 21, 2020, 01:20:22 PM »

While all the const char warnings are not shown anymore when compiling the bcx source there are error issues when using a good share of my library functions.
James
==============================================================================
Example:
Code: [Select]
$CPP
$NOMAIN
'$ONEXIT "VSCPP.BAT $FILE$ -m64 con"

'==============================================================================
Function TestOne( s1 As const char Ptr) As Integer
Dim s2$
s2$ = ucase$(s1)
? s2$
Function = 1
End Function
'==============================================================================
Function main()

? "Hello There"
Pause
End Function


relevant c++ code:
Code: [Select]
char *ucase (char *S)
{
  char *strtmp = BCX_TmpStr(strlen(S));
  return CharUpperA(strcpy(strtmp,S));
}


void Pause(void)
{
  printf("\n%s\n","Press any key to continue . . .");
  _getch();
}



// *************************************************
//            User's Subs and Functions
// *************************************************

int TestOne (const char*  s1)
{
  char    s2[BcxStrSize]={0};
  strcpy(s2,ucase(s1));
  printf("%s\n",s2);
  return 1;
}


int main ()
{
  printf("%s\n","Hello There");
  Pause();
  return 0;
}


Error:
[vcvarsall.bat] Environment initialized for: 'x86_x64'
Compiling "T01.cpp" To " a Windows Console App"
T01.cpp
T01.cpp(221): error C2664: 'char *ucase(char *)': cannot convert argument 1 from 'const char *' to 'char *'
T01.cpp(221): note: Conversion loses qualifiers
T01.cpp(199): note: see declaration of 'ucase'

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: const char errors
« Reply #1 on: July 21, 2020, 03:45:03 PM »
JC,

To be clear, those are YOUR errors, not BCX's.

Changing "const char *" to "char *" allows your sample to compile with MSVC++

That said, I have spent hours today converting function args from "char*" to "const char*", along
with changing some locals to "const char *" and casting some returns to "char*" inside those functions. 
A small handful of functions with string arguments cannot be converted without significant changes
that I'm not prepare to do at this time.  But most have been converted and BCX is compiling well with
all the compilers that I use.

Next comes the testing. 

I'll test all the demos and a few of my personal apps but you and others will need to test code that
relies on the C++ family -- if we get to that point.  If our tests are mostly successful, these changes
will likely be included in 7.5.1.


jcfuller

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Re: const char errors
« Reply #2 on: July 21, 2020, 05:29:06 PM »
Woot!!
I am ready to test.
Great work!!

James

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: const char errors
« Reply #3 on: July 21, 2020, 08:50:43 PM »
These are the 300+ lines that received the "const char *" treatment today.

I'm still testing but so far, all con,gui, and dll samples along with several of my larger projects, including BCX itself, all compile and run as expected.  I'm certain that I don't have a sample for every keyword, so I want to do more testing before releasing an ALPHA copy.


Code: [Select]
BCX_FrameWnd (const char* ,WNDPROC,const char* ,HMENU=NULL,int=0,int=CW_USEDEFAULT,int=CW_USEDEFAULT,int=CW_USEDEFAULT,int=CW_USEDEFAULT,int=0,int=0);"
BCX_Wnd (const char*,WNDPROC,const char* ,HWND=0,int=CW_USEDEFAULT,int=CW_USEDEFAULT,int=CW_USEDEFAULT,int=CW_USEDEFAULT,int=0,int=0,int=0);"
BCX_SetCursor (HWND, const char *);"
BCX_SetMetric (const char *);"
BCX_RegWnd (const char *, WNDPROC);"
APPACTIVATE (const char *);"
InputBox(const char*,const char*,const char*, int=0);"
CreatePrompter(const char*,const char*,const char*,INT);"
VBS_RUN_SCRIPT (const char*);"
VBS_ADDCODE    (const char*);"
VBS_EVAL_NUM   (const char*);"
VBS_EVAL_STR   (const char*);"
INFOBOX(const char*,const char*,int=170,int=165);"
BCX_MDICHILD (const char *, const char *,int=CW_USEDEFAULT,int=CW_USEDEFAULT,int=CW_USEDEFAULT,int=CW_USEDEFAULT,DWORD=0,LPARAM=0);"
BCX_MDIALOG(DLGPROC,const char*,HWND,int=0,int=0,int=250,int=150,int=0,int=0,const char* =0,int=0);"
BCX_DIALOG(DLGPROC,const char*,HWND,int=0,int=0,int=250,int=150,int=0,int=0,const char* =0,int=0);"
BCX_FORM(const char*,int=0,int=0,int=250,int=150,int=-1,int=0);"
SetDimension (const char* , INT, HWND, BOOL=FALSE);"
GetDimension(const char* ,HWND, BOOL=FALSE);"
BCX_EDIT(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=-1);"
BCX_INPUT(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=-1);"
BCX_BUTTON(const char*,HWND,int=0,int=0,int=0,int=0,int=0,int=0,int=-1);"
BCX_BMPBUTTON(const char*,HWND,int=0,int=0,int=0,int=0,int=0,int=0,int=0,int=-1);"
BCX_LABEL(const char*,HWND,int=0,int=0,int=0,int=0,int=0,int=0,int=0);"
BCX_GROUP(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=0);"
BCX_CHECKBOX(const char*,HWND,int=0,int=0,int=0,int=0,int=0,int=0,int=0);"
BCX_RADIO(const char*,HWND,int=0,int=0,int=0,int=0,int=0,int=0,int=0);"
BCX_COMBOBOX(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=-1);"
BCX_LISTBOX(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=-1);"
BCX_BLACKRECT(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=0);"
BCX_WHITERECT(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=0);"
BCX_GRAYRECT(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=0);"
BCX_DATEPICK(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=-1);"
BCX_RICHEDIT (const char*,HWND,INT,INT,INT,INT,INT,int=0,int=-1);"
SETWINDOWRTFTEXT (HWND, const char *);"
BCX_STATUS (const char*,HWND,int=200,int=1,INT* =0);"
BCX_OLEPICTURE(const char*,HWND=0,int=0,int=0,int=0,int=0,int=0,int=0,int=0,int=0);"
BCX_BITMAP(const char*,HWND=0,int=0,int=0,int=0,int=0,int=0,int=0,int=0,int=0);"
BCX_ICON(const char*,HWND=0,int=0,int=0,int=0,int=0,int=0,int=0,int=0,int=0);"
BCX_LISTVIEW(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=-1,int=15);"
BCX_TREEVIEW(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=-1);"
BCX_CONTROL (const char*,HWND,const char*,INT,INT,INT,INT,INT,int=0,int=0);"
BCX_PROGRESSBAR (const char*,HWND,int=0,int=0,int=0,int=0,int=0,int=0,int=-1);"
BCX_SLIDER(const char*,HWND,INT,INT,INT,INT,INT,int=0,int=0,int=0);"
BCX_TOOLBAR (HWND,INT,INT,const char* =0,INT* =0,void* =0,INT* =0,int=0,int=0,int=0,int=0);"
BCX_AddTab (HWND, INT, const char*, int=-1, int=0);"
BCX_PRINT (HWND, INT , INT , const char *, HDC=0);"
GetResource(INT, const char*, DWORD*);"
BCX_SET_TEXT(HWND,const char*);"
EDITLOADFILE (HWND, const char*);"
LISTBOXLOADFILE(HWND,const char*,int=0,int=0);"
COMBOBOXLOADFILE(HWND,const char*);"
BCX_SET_FONT (const char *,float,int=0,int=0,int=0,int=0,int=0);"
SET_BCX_BITMAP(HWND,const char*,int=0,int=0,int=0);"
SET_BCX_BMPBUTTON(HWND,const char*,int=0);"
SET_BCX_ICON(HWND,const char*,int=0,int=0,int=0);"
BCX_LOADBMP (const char *, int=0, int=0);"
BCX_LOADIMAGE (const char *, int=0);"
Bcx_ToolTip (const char*,HWND,int=0);"
PLAYWAV (const char *,int=0, int=SND_SYNC);"
RUN (const char*, INT =1, INT =0);"
sziif (bool,const char*,const char*);"
sziif (BOOL,const char*,const char*);"
Using (const char*,double);"
TempFileName (const char*,const char*);"
lcase (const char*);"
ucase (const char*);"
mid (const char*, INT, int=-1);"
ltrim (const char*,char=32);"
rtrim (const char*,char=32);"
trim (const char*);"
strim   (const char*);"
left (const char*,INT);"
right (const char*,INT);"
rpad (const char*,INT,int=32);"
lpad (const char*,INT,int=32);"
REPEAT (INT,const char*);"
extract (const char*,const char*);"
remain (const char*,const char*);"
reverse (const char*);"
mcase (const char*);"
findfirst (const char*);"
Environ (const char*);"
SEARCHPATH (const char *);"
BcxSplitPath (const char *, INT);"
StrToken (const char*,const char*,INT);"
RegString (HKEY,const char*,const char*);"
CREATEREGSTRING (HKEY,const char*,const char*,const char*);"
DELETEREGKEY (HKEY,const char*);"
CREATEREGINT (HKEY,const char*,const char*,INT);"
REGINT (HKEY,const char*,const char*);"
FILELOCKED (const char*);"
BFF (const char*,int=0,const char* =0);"
FILLARRAY (const char *, INT, INT, void *);"
IRemoveStr (const char*,const char*);"
GetFileName (const char*,const char*,int=0,HWND=0,DWORD=0,const char* =0,const char* =0,INT* =0);"
GETTEXTSIZE (const char*, HWND=0, HFONT=0);"
enc (const char*, int=0, int=0);"
ASC (const char *,int=0);"
INSTRREV (const char*,const char*,int=0,int=0);"
FINDFIRSTINSTANCE (const char*);"
INSTR(const char*,const char*,int=0,int=0);"
_stristr_(const char*,const char*);"
VERIFY (const char *, const char *);"
VerifyInstr(const char*,const char*,int=0);"
Retain (const char*,const char *);"
LoadFile (const char*);"
INCHR (const char*,const char*);"
MSGBOX (const char*,const char*,INT);"
LIKE (const char*,const char*);"
LeftStr  (const char*,const char*,int=0);"
RightStr (const char*,const char*,int=0);"
TALLY (const char*,const char*,int=0);"
BIN2DEC (const char*);"
HEX2DEC (const char*);"
DOWNLOAD (const char*,const char*);"
EXIST   (const char*);"
Exist_A (const char*);"
Exist_B (const char*);"
ins (const char *S, INT i, const char *a);"
del (const char*,INT,INT);"
LOF (const char*);"
scan (const char *INPUT, const char *format, ... );"
SPLIT (char []";csBcxStrSizeBrackets$;", const char*, const char*, int=0);"
DSPLIT (LPSTR *, const char*, const char*, int=0);"
SYSSTR (const char * szIn, int=0, int=0);"
ANSITOWIDE (const char*,UINT=CP_ACP,DWORD=MB_PRECOMPOSED);"
bcx_com_trace_add_line(const char* dp);"
CVI (const char*);"
CVL (const char*);"
CVS (const char*);"
CVD (const char*);"
CVLD (const char*);"
BCX_LoadDll(const char *);"
BCX_DynaCallB(const char *, const char *, INT, ...);"
BCX_DynaCallA(const char *, const char *, INT, INT *);"
CONTAINEDIN(const char * ,const char **,int=0);"
FINDINTYPE(const const char *,const char *,INT,INT,INT,int=0,INT* =0);"
PrinterOpen  (const char * =" & ENC$("Courier NEW") & ",int=12,int=DEFAULT_CHARSET);"
Bcx_ToolTip (const char *Text, HWND hWnd, INT TTStyle)"
"  ti.lpszText=(char*)Text;"
LeftStr (const char *A, const char *B, INT Insens)"
RightStr (const char *A,const char *B, INT Insens)"
APPACTIVATE (const char *Z)"
left (const char *S, INT  length)"
right (const char *S, INT length)"
rpad (const char *a, INT L, INT c)"
"  if((L-s)<1) return (char*)a;"
lpad (const char *a, INT L, INT c)"
"  if(L<1) return (char*)a;"
mid (const char *S, INT start, INT length)"
trim (const char *S)"
"  if(S[0]==0) return (char*)S;"
ltrim (const char *S, char c)"
"  if(S[0]==0) return (char*) S;"
rtrim (const char *S,char c)"
"  if(S[0]==0) return (char*)S;"
strim (const char *src)"
extract (const char *mane, const char *match)"
"  const char *a;"
remain (const char *mane, const char *mat)"
"  const char *p = strstr(mane,mat);"
"    return (char*)p;"
"  return (char*)mane;"
reverse (const char *s)"
findfirst (const char *S)"
ucase (const char *S)"
lcase (const char *S)"
mcase (const char *S)"
IRemoveStr (const char *a, const char *b)"
ins (const char *S, INT i, const char *a)"
"  if(i<1 || i>j+1) return (char*)S;"
del (const char *S, INT i, INT j)"
"  if(i<1 || i>ln) return (char*)S;"
REPEAT (INT count, const char *a)"
enc (const char *A, INT L, INT R)"
Environ(const char *S)"
GetFileName(const char *Title,const char *Filter,INT Flag,HWND hWnd,DWORD Flags,const char *InitialDir,const char *Initfname,INT *ExtIdx)"
TempFileName (const char *Folder,const char*Prefix)"
Using (const char *Mask, double Num)"
"  const char* p = Mask;"
SEARCHPATH (const char *szFile)"
INSTRREV (const char *s, const char *p, INT os, INT sens)"
INSTR(const char* mane,const char* match,INT offset,INT sensflag)"
"  const char *s;"
_stristr_(const char *String, const char *Pattern)"
"  return (char*)String;"
INCHR (const char *A, const char *B)"
"  const char* C=A;"
ASC (const char *z,INT index)"
EXIST (const char *szFilePath)"
Exist_A (const char *szFilePath)"
Exist_B (const char *szFilePath)"
TALLY (const char *szLine, const char *szChar, INT sensflag)"
" const char *p = (sensflag == 0 ? strstr(szLine, szChar) : _stristr_(szLine, szChar));"
LIKE(const char *RAW, const char *pat)"
"  const char *r, *p;"
LOF (const char *FileName)"
sziif (bool i, const char *a, const char *b)"
sziif (BOOL i, const char *a, const char *b)"
"  if(i) return (char*)a;"
"  return (char*)b;"
FILLARRAY(const char *INPUT, INT ArrayType, INT MaxCnt, void *Array)"
scan(const char *INPUT, const char *format, ... )"
SPLIT (char Buf[]";csBcxStrSizeBrackets$;", const char *T, const char *Delim, INT Flg)"
DSPLIT (LPSTR *Buf, const char *T, const char *Delim, INT Flg)"
BIN2DEC (const char *cptr)"
HEX2DEC (const char *szInput)"
"  const char  *dwLen   = szInput+strlen(szInput);"
VERIFY (const char *Src, const char *Allowed)"
Retain (const char *Text, const char *ValidChars)"
LoadFile (const char *N)"
MSGBOX (const char *pszMsg, const char *pszTitle, INT iNum)"
RUN (const char* Cmdline, INT ShowHide, INT WaitState)"
"  if(CreateProcess (NULL,(char*)Cmdline,NULL,NULL,FALSE, NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi)==0)"
PLAYWAV (const char *A, INT rsid, INT Sync)"
DOWNLOAD (const char *URL,const char *Localname)"
FINDFIRSTINSTANCE (const char *Application)"
InputBox (const char *Title, const char *Prompt, const char *Value, INT iHide)"
"(const char *Title, const char *Prpt, const char *Value, int iHide)"
INFOBOX(const char *Title, const char *Value, INT xSize, INT ySize)"
BCX_PRINT(HWND hWnd, INT x, INT y, const char *Text, HDC DrawHDC)"
BCX_MDIALOG (DLGPROC DPro,const char *title,HWND hWnd,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle,const char *fntface,INT fsz)"
BCX_DIALOG (DLGPROC DPro,const char *title,HWND hWnd,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle,const char *fntface,INT fsz)"
GetDimension (const char * PROPNAME,HWND WINHANDLE,BOOL InPixel)"
SetDimension (const char * PROPNAME,INT PROPVAL,HWND WINHANDLE,BOOL InPixel)"
BCX_FORM(const char *Caption,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_STATUS (const char *Text, HWND hWnd, INT ID, INT numparts, INT *parts)"
BCX_BUTTON(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_BMPBUTTON(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Res,INT Style,INT Exstyle)"
BCX_EDIT(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
EDITLOADFILE (HWND hWnd, const char *File)"
LISTBOXLOADFILE (HWND hWnd, const char *A, INT apend, INT scrol)"
COMBOBOXLOADFILE (HWND hWnd, const char *A)"
BCX_INPUT(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_LABEL(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_GROUP(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_CHECKBOX(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_RADIO(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_COMBOBOX(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_LISTBOX(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_TREEVIEW(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_BLACKRECT(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_WHITERECT(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_GRAYRECT(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_DATEPICK(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
BCX_RICHEDIT(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
SETWINDOWRTFTEXT (HWND hWnd, const char *Text)"
BCX_BITMAP(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Res,INT Style,INT Exstyle)"
BCX_OLEPICTURE(const char* szFile,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Res,INT Style,INT Exstyle)"
BCX_ICON(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Res,INT Style,INT Exstyle)"
BCX_LISTVIEW(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle, INT Cols)"
BCX_CONTROL(const char *Class,HWND hWnd,const char *Caption,INT id,INT x,INT y,INT w,INT h,INT Style,INT Exstyle)"
BCX_PROGRESSBAR(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT Style,INT Exstyle)"
GetResource(INT Res, const char *ResType, DWORD *ResSize)"
GETTEXTSIZE(const char *Text, HWND hWnd, HFONT fnt)"
"  GetTextExtentPoint32(hdc,(char*)Text,strlen(Text),&sz);"
BCX_SLIDER(const char *Text,HWND hWnd,INT id,INT X,INT Y,INT W,INT H,INT orient,INT Style,INT Exstyle)"
BCX_AddTab (HWND thwnd,INT idx,const char * text,INT Imgidx,INT showhide)"
"  tc.pszText=(char*)text;"
BCX_TOOLBAR (HWND hWnd,INT id,INT NumBtns,const char * Text,INT* Bstyles,void* img,INT* imgidx,INT bx,INT by,INT Style,INT ExStyle)"
BCX_SET_TEXT(HWND hWnd, const char *Text)"
BCX_SET_FONT (const char *Font,float Size,INT Bold,INT Italic,INT Underline,INT StrikeThru,INT CharSet)"
SET_BCX_BITMAP(HWND hWnd,const char* File,INT Res, INT W, INT H)"
SET_BCX_BMPBUTTON(HWND hWnd,const char* File,INT Res)"
"     Bm_Handle=(HBITMAP)LoadImage(0,(char*)File,IMAGE_BITMAP,"
BCX_LOADBMP (const char *F, INT i, INT t)"
BCX_LOADIMAGE (const char *szFile, INT Res)"
CVI (const char *s)"
CVL (const char *s)"
CVS (const char *s)"
CVD (const char *s)"
double CVLD (const char *s)"
BCX_LoadDll (const char *DllName)"
BCX_DynaCallB (const char *FuncName, const char *DllName, INT nArgs, ...)"
BCX_DynaCallA (const char *DllName, const char *FuncName, INT nArgs, INT argtable[])"
BFF(const char *Instructions,INT BIF_Flags,const char *InitPath)"
"{"
BcxSplitPath (const char *FPath, INT mask)"
RegString (HKEY hKey, const char *RegPath, const char *SubKey)"
CREATEREGSTRING (HKEY HK, const char *Key, const char *VarName, const char *Value)"
StrToken (const char *Source, const char *TokenChar, INT n)"
"  const char *Copy;"
"  strcpy(BCX_RetStr,(char*)RemoveStr(RetVal,(char*)TokenChar));"
DELETEREGKEY (HKEY HK, const char *Key)"
CREATEREGINT (HKEY HK, const char *Key, const char *VarName, INT Value)"
PrinterOpen (const char * fontname,INT PointSize,INT charset)"
PrinterWrite (const char *TextIn, INT CPL, INT LPP)"
SYSSTR (const char * szIn, INT widstr, INT bfree)"
ANSITOWIDE (const char *AnsiStr, UINT CodePage,DWORD dwFlags)"
VBS_RUN_SCRIPT (const char *VB_SCRIPT)"
VBS_ADDCODE (const char *Code)"
FILELOCKED (const char *Filename)"
CONTAINEDIN(const char * Token,const char **Contain ,INT c)"
FINDINTYPE(const char *Token,const char *StOffset,INT StSize,INT start,INT finish,INT c,INT *idx)"
"    const char *Srch;"
BCX_FrameWnd (const char * classname,WNDPROC  FrameWndProc,const char * caption,HMENU  hMenu,INT nMenuPos,INT x,INT y,INT w,INT h,INT nStyle,INT nExStyle)"
BCX_Wnd(const char * classname,WNDPROC  wndProc,const char * caption, HWND hParentWnd,INT x,INT y,INT w,INT h,INT nStyle,INT nExStyle,INT nID)"
BCX_SetCursor (HWND hWnd, const char *cCursor)"
BCX_SetMetric (const char *metric)"
BCX_RegWnd (const char *classname, WNDPROC Form_WndProc)"
BCX_MDICHILD (const char *title, const char *MdiClassName,INT x,INT y,INT cx,INT cy,DWORD style,LPARAM lParam)"
VarCode.Header$ = main(INT ARGC, const char *argv[])"
VarCode.Proto$  = main(INT ARGC, const char *argv[]);"


MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: const char errors
« Reply #4 on: July 21, 2020, 10:52:19 PM »
I've decided to replace "const char *" with LPCTSTR, as LPCTSTR seems more useful.


LPCTSTR is a pointer to a const TCHAR string.

TCHAR being either a wide char or char depending on whether UNICODE is defined in your project

Peter1956nl

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: const char errors
« Reply #5 on: August 05, 2020, 03:49:32 PM »
Hello MrBcx,

Compiling BCX 751 the lib with PellesC10 win 32 i get this error message:
bcx_com_trace_add_line.c(3): error #2120: Redeclaration of 'bcx_com_trace_add_line', previously declared at C:\PellesC\Include\bcxLib.h(573); expected 'void __cdecl function(const char *)' but found 'void __cdecl function(char *)
I will try version 752. Gives the same error message.
Is this an issue for a next version?
Greetings

Peter
« Last Edit: August 05, 2020, 04:09:00 PM by Peter1956nl »

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: const char errors
« Reply #6 on: August 05, 2020, 04:20:27 PM »
Hello MrBcx,

Compiling the lib with PellesC10 win 32 i get this error message:
bcx_com_trace_add_line.c(3): error #2120:
Redeclaration of 'bcx_com_trace_add_line', previously declared at
C:\PellesC\Include\bcxLib.h(573);
expected 'void __cdecl function(const char *)'
but found 'void __cdecl function(char *)

Is this an issue for a next version?
Greetings

Peter

Hi Peter,

Thank you for the bug report. 

The problem is that the prototype for bcx_com_trace_add_line was recently changed to LPCTSTR but the actual function is still coded as char * . 

I have uploaded a corrected version of 752, that I expect will solve your issue.  Let me know if it doesn't or if you run into any other problems.

Thanks,
Kevin

https://bcxbasiccoders.com/archives/YahooGroups/Bcx_Files_New/Bcx752.zip