Serving the Quantitative Finance Community

 
User avatar
fearless
Topic Author
Posts: 0
Joined: October 9th, 2003, 6:45 pm

Converting C++ code to Excel Add-in

August 24th, 2004, 12:16 pm

What is the easiest way to convert C++ code to an Excel Add-in if I am using a Bloodshed C++ editor? Thank you for your input.
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

Converting C++ code to Excel Add-in

August 24th, 2004, 5:28 pm

You will need a compiler as well Anyway it all depends how fancy you want to get. You can build a DLL easily and call it from VBA or you can go the whole hog and develop an XLL with support for XLOPERs etc and support the function addin. A good place to look is the following:www.whopper.co.ukHe covers many of the issues of developing XLLs. Also, get the Excel SDK. money well spent if you are going to do loads of these.
Last edited by daveangel on August 23rd, 2004, 10:00 pm, edited 1 time in total.
knowledge comes, wisdom lingers
 
User avatar
mj
Posts: 12
Joined: December 20th, 2001, 12:32 pm

Converting C++ code to Excel Add-in

August 24th, 2004, 5:48 pm

i think you meanwww.whooper.co.ukDoes anyone know of a package that builds an xll using the Mingw compiler? Preferably with a nice DevCpp project file.
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

Converting C++ code to Excel Add-in

August 24th, 2004, 8:48 pm

Should stop thinking about burgers
Last edited by daveangel on August 23rd, 2004, 10:00 pm, edited 1 time in total.
knowledge comes, wisdom lingers
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Converting C++ code to Excel Add-in

August 25th, 2004, 7:47 pm

http://www.wileyeurope.com/WileyCDA/Wil ... .htmlThere is a chapter in the above book on the whole topic of Excel addin in C++ (with source code on CD as well)
 
User avatar
mj
Posts: 12
Joined: December 20th, 2001, 12:32 pm

Converting C++ code to Excel Add-in

August 26th, 2004, 5:31 am

does it work with the mingw compiler?
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Converting C++ code to Excel Add-in

August 26th, 2004, 11:04 am

Doubtful if it works. In general, Microsoft software works best with Microsoft. Might work with Borland compilers.What is mingw?
 
User avatar
mj
Posts: 12
Joined: December 20th, 2001, 12:32 pm

Converting C++ code to Excel Add-in

August 26th, 2004, 11:41 am

mingw is the windows port of g++ there seems to be lots of packages that work with Visual C++, e.g. the whooper stuff and xlw.sourceforge.netthe only one I've come across for mingw I couldn't get to work. However, since my favourite free IDE and compiler is devcpp with mingw i'd like a package that icould build xlls with. This would be good for all the poor students who frequent this fourm.
 
User avatar
MarcusCuda
Posts: 0
Joined: July 30th, 2004, 11:48 am

Converting C++ code to Excel Add-in

August 26th, 2004, 11:48 am

Microsoft now gives away the command line version of their VC++ 2003 compiler (it is the optmizing compiler,not the limited version that comes with VC++ standard).
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

Converting C++ code to Excel Add-in

August 26th, 2004, 11:57 am

MS offer the command line version of their compiler free, which should suit many poor students.What is mingw missing to stop you building XLLs/DLLs ?I would be mildly surprised if you could build a working Win32 compiler that stopped you doing this.That being said, I imagine it needs a good hard kick and a bit of documenation.I've used the Whitesmith compiler. Nothing scares me. The screaming when I wake up in the middle of the night is due to my more pleasant experiences as a hostage in Beirut.It's has the immortal phrase in the manual :"You are not expected to understand this, it is included for completeness only."MJ has a nice rich employer, so presumably can use VC++, but are there really a horde of impverished students desparate for this ?If so, I'll do it on the tube.
 
User avatar
mj
Posts: 12
Joined: December 20th, 2001, 12:32 pm

Converting C++ code to Excel Add-in

August 26th, 2004, 12:40 pm

i certainly agree that it could be done -- the problem is that all the nice packages are very microsoft specific and so don'tport easily. It needs an expert like DCFC to do it.MJ
 
User avatar
sm345
Posts: 0
Joined: July 26th, 2004, 10:37 am

Converting C++ code to Excel Add-in

September 9th, 2004, 7:59 pm

Microsoft provides a brief tutorial to build xll at : http://support.microsoft.com/default.as ... tent=1Have not tried it. Hopefully it works! However, why do people prefer xll to dll? You could write a standard DLL, and have a little VBA glue to call it from excel. Provides flexibility to use it from anything can can consume com
 
User avatar
Boofta
Posts: 0
Joined: July 14th, 2002, 3:00 am

Converting C++ code to Excel Add-in

September 10th, 2004, 2:42 am

One reason is that XLL calls are much faster than VBA calls (or COM Add-in calls for XP). As discussed on whooper's site.What matters to you - speed of execution or speed of development?
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

Converting C++ code to Excel Add-in

September 10th, 2004, 5:11 am

XLLs are integrated into Excel. This means that the function wizard knows about it and you can also have your own custom menu driven by the XLL. Also, you can have your XLLs open automatically when excel opens up. And once you have written one XLL it pretty easy to write others. The framework is very neat.
Last edited by daveangel on September 9th, 2004, 10:00 pm, edited 1 time in total.
knowledge comes, wisdom lingers
 
User avatar
sm345
Posts: 0
Joined: July 26th, 2004, 10:37 am

Converting C++ code to Excel Add-in

September 10th, 2004, 1:29 pm

QuoteWhat matters to you - speed of execution or speed of development?I think speed of development will be roughly the same in both cases -- DLL and XLL. I was thinking more in terms of flexibility even at the expense of some speed. I can build a DLL and then call it from Excel and also from, for example, Matlab or my own GUI.Based on yours and daveangels comments, XLLs provide a native feel to Excel users. So perhaps the most flexible architecture would be:1. Build a DLL with the functionality2. Build a shim (adapter? bridge?) XLL which calls the DLL for its work3. Build a shim for MATLAB4. Build a shim for XXXThanks.Sanjeev