Full_Name: Ben K. Version: 1.7.1 OS: Win 2000 Submission from: (NULL) (208.243.20.222) This C code doesn't crash: void init(SEXP rho, int *o){ SEXP vars = findVar(install("vars"), rho); } It's called using: vars <-as.data.frame(NULL) vars$delta <-7 dyn.load("c_fns.dll") print(.C("init",.GlobalEnv,o=as.integer(3))$o) However, this does crash (``Rgui has generated errors and will be closed by Windows''): void init(SEXP rho, int *o){ SEXP vars = findVar(install("vars"), R_GlobalEnv); } This also crashes: void init(SEXP rho, int *o){ SEXP vars = findVar(install("vars"), rho); *o = INTEGER(getListElement(vars,"delta"))[0]; } (where GetListElement is that function from the R help) Further, if I source dyn.load("c_fns.dll") twice, R starts churning away, taking up 100% of the CPU to do nothing, until I pull up the task manager and kill R. This happens whether I've called dyn.unload or not. All of this runs just fine under Linux. But I have no experience with programming in Windows, so this is all too subtle for me to work out. Thaks for your help, B