View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kevin Love Kevin Love is offline
external usenet poster
 
Posts: 2
Default XLL - VS .Net2003 - init problem - const char strings - /Gf option??


Huge thanks to Rob Bovey - Excel Guru!!
You saved me many hours of pain with your lucent
explanation of how writing to string literals is
no longer supported in VS .Net.
Too bad the MSDN documentation for making XLLs hasnt been
updated to reflect this behavior change.

To anybody who used the examples in the Excel SDK,
please note, this code will no longer work.

static char* xll_name_buf = " my excel string.";
xInfo.xltype = xltypeStr;
xInfo.val.str = xll_name_buf;
xInfo.val.str[0] = lstrlen(&xll_name_buf[1]);

similarly,

Excel(xlcAlert, 0, 2, TempStr(" ERROR: Bad reset hols."),
TempInt(2) );

###############################################

The solution seems to be putting the character string
on the stack. Be careful though - you cant use
very much stack space in excel, otherwise you will
get mysterious crashes......

Kevin