Serving the Quantitative Finance Community

 
User avatar
charleslliu
Topic Author
Posts: 0
Joined: July 14th, 2005, 1:34 am

VBA C++ Dll

November 16th, 2006, 7:59 pm

Hi, Could anyone let me how to solve my problem? thanks in advance1) In excel, I have an array of 8 elements ( from 6month up to 10 years interest rate curve) 2) In C++ Dll, in order to build a binomial tree, I create several arrays with the size of [120][120]apparently, when I called Dll from VBA, I got the error message of "Run time error '28', out of stack space"anyone knows how to solve this memory issue? thanks ( I did have a successful run of an interest rate curve up to 8 years, i.e. in C++ dll, I have several arrays with the size of [96][96])
 
User avatar
fkato
Posts: 0
Joined: September 6th, 2005, 4:41 am

VBA C++ Dll

November 17th, 2006, 2:58 am

Excel 97 and up have a stack limit of about 44K. So don't use auto arrays, use the heap (malloc, new) to allocate data. Besides that, depending on the compiler, arrays of double allocated in the stack (auto) may not be 8-byte aligned.fkato.
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

VBA C++ Dll

November 17th, 2006, 11:43 am

Wanton Plug...The CQF C++ course will do this stuff...What you need to do is drop in the DangerArray class in my lecture notes attached to this post. For your particular issue, I'd make sure that I was 100% on ByRef and ByVal
Last edited by DominicConnor on November 19th, 2006, 11:00 pm, edited 1 time in total.
 
User avatar
charleslliu
Topic Author
Posts: 0
Joined: July 14th, 2005, 1:34 am

VBA C++ Dll

November 17th, 2006, 2:58 pm

thanks everyone, last night I did solve the problem by declaring function variables as static. a hint i got from Dalton's bookcheers
 
User avatar
phenomenologist
Posts: 0
Joined: November 14th, 2003, 5:06 pm

VBA C++ Dll

November 18th, 2006, 8:02 pm

The xl8.zip page is not found, btw:-(
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

VBA C++ Dll

November 20th, 2006, 7:39 pm

Seems to be a bug in the system. PM me with your email...
Last edited by DominicConnor on November 19th, 2006, 11:00 pm, edited 1 time in total.
 
User avatar
maccc
Posts: 0
Joined: July 20th, 2006, 7:20 am

VBA C++ Dll

November 25th, 2006, 6:38 am

hi DCFC, I am also interested in your notes to compile dll for VBA! Could you send me your full version?
Last edited by maccc on November 24th, 2006, 11:00 pm, edited 1 time in total.