Page 1 of 1
C++ DLL from Excel
Posted: August 10th, 2009, 1:38 pm
by gauravkumar2
Hi AllI have the following simple C++ program:double* __stdcall arr(int n){double *a=new double[n];for(int i=0;i<n;i++)a=1;return a;}I am compilinng the file and getting the DLL file. Could any one tell me how to call this function in VBA and how to use it excel? PS: I posted the query in technical forum and I was told to paste it here. I am sorry for the same.RegardsGaurav
C++ DLL from Excel
Posted: August 10th, 2009, 2:01 pm
by AlexesDad
1. You code is very dangerous. You are allocating memory on the heap and not freeing it.2. If you want to write C++ functions for use in Excel then write XLLs and you won't need the VBA wrappers.
C++ DLL from Excel
Posted: August 11th, 2009, 4:27 am
by gauravkumar2
I can not write XLL because of some technical problems. I have to work with DLL
C++ DLL from Excel
Posted: August 11th, 2009, 4:36 am
by AlexesDad
See this thread.Out of curiosity, what technical problems ?