C or C++

I get quite a lot of correspondence around xlls. These are mainly coded in C or C++, and many people are not totally clear on the difference. Language purist are going to hate this, but here goes:

C is like modules in VBA, C++ is like classes.

If all your VBA is in classes (why would you do that in Excel??) then C++ will probably make more sense to you.

If most of your VBA is in modules then plain (or should that be pure?) C will suit you better.

If you have some monster horrible stuff to code, then the OO side of C++ will probably give it the edge, or if you have existing C++ resources you want to expose to Excel, C++ may be better.

But for many VBA devs just wanting moderately simple functions to perform sensibly C is probably the best bet.

Thats a bit of an issue as almost all the frameworks, and tools for writing xlls, are aimed at exposing Excel to C++ devs. None are aimed at helping VBA devs understand this fast xll interface, That what I intend to correct over the next few months.

Excel has an API that is accessible from C (cunningly called the C API), and just about accessible from C++ (If you get it to pretend it is C code).

My advice is the think C when thinking about xlls, that is after all what most of the windows API dlls we use are coded in.

cheers

Simon

Advertisements

3 Responses to “C or C++”

  1. MacroMan Says:

    You use xlls written in C/C++?? What for? Usually, in quantitative finance anyways, they’re used for building complex mathematical models used for pricing some exotic financial or energy derivative. What are some of the projects you have worked on using xlls?

  2. Jelle-Jeroen Says:

    Looking forward to your posts.
    I’m interested in this subject for a long time and I was looking for sample source.
    It would be very handy to have a couple of simple functions witch cover the basic handeling of ranges etc….

    Jelle-jeroen

  3. Marcus Says:

    MacroMan, another example I’ve seen is Essbase Enterprise (general ledger) which provided an interface to accounts data via Excel worksheet functions which, I believe, was implemented via an XLL.

    Regards –

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: