//------------------------------------------------------------------- cpp_xloper::cpp_xloper(WORD rows, WORD cols, char **str_array) { Clear(); xloper *p_oper; if(!str_array || !set_to_xltypeMulti(&m_Op, rows, cols) || !(p_oper = m_Op.val.array.lparray)) return; m_DLLtoFree = true; // Class will free the strings too char *p; for(int i = rows * cols; i--; p_oper++) { p = new_xlstring(*str_array++); // make copies if(p) { p_oper->xltype = xltypeStr; p_oper->val.str = p; } else { p_oper->xltype = xltypeNil; // p_oper->xltype = xltypeMissing; } } }
//------------------------------------------------------------------- void set_to_text(xloper *p_op, const char *text) { if(!p_op) return; if(!(p_op->val.str = new_xlstring(text))) p_op->xltype = xltypeNil; else p_op->xltype = xltypeStr; }
__declspec(dllexport) int __stdcall xlAutoOpen(void) { check_init(); static XLOPER xDLL; int i; Excel4(xlGetName, &xDLL, 0); static XLOPER xRegister; xRegister.xltype = xltypeStr; for (i=0; i<2; i++) { XLOPER* fn = new_xlstring(expy_funcs[i][0]); XLOPER* ret = new_xlstring(expy_funcs[i][1]); XLOPER* alias = new_xlstring(expy_funcs[i][2]); BOOL success = Excel4(xlfRegister, 0, 4, &xDLL, fn, ret, alias) == xlretSuccess; free(fn); free(ret); free(alias); } /* Free the XLL filename */ Excel4(xlFree, 0, 1, &xDLL); return 1; }