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

Hi Kevin,

One idea, make sure that your nFuncs array is declared similar to the
following:

#define NUM_FUNCS 5
#define NUM_ARGS 9
#define MAX_LENGTH 255

static char nFuncs[NUM_FUNCS][NUM_ARGS][MAX_LENGTH] =
{
// function table array
};

instead of like this:

#define NUM_FUNCS 5
#define NUM_ARGS 9

static char nFuncs[NUM_FUNCS][NUM_ARGS] =
{
// function table array
};

The latter example was the method demonstrated in the XLL framework provided
with the Excel SDK, but it's an invalid construct in this context. You can't
add byte counts to the strings in this array later on because writing to
string literals is undefined. It works when compiled as a C project in VC6,
but that's just pure luck.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Kevin Love" wrote in message
...[i]

Trying to port large .xll project to VS .Net 2003.
Failing to load add-in.

problem seems to be due to inability of compiler to
read/write strings.

compiled using compiler flag /Gf, get warning message

c1xx : warning C4349: /Gf is deprecated and will not be
supported in future versions of Visual C++; remove /Gf or
use /GF instead

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

Downloaded Anewxll project from msdn web site - same
problem. Xll refuses to run - crashes on init
in the following code.

for(nFuncs=0; func[nFuncs][0]; nFuncs++) {
for(i=0; i<9; i++) {
func[nFuncs][i][0] = (BYTE) strlen(func[nFuncs]
+1);
}
}

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

Any ideas appreciated.

Kevin Love