 |
bluematrix
Registered: Jan 2012
Posts: 114 |
07-15-12 12:44 AM
Hi
I want some expert/experienced advice on the best approach/method of using C++ code in Excel. For example building some pricing models in C++ and using them in Excel.
I know there are various ways so I want your opinion.
It seems there are lot of pages on using COM. but I personally think COM is OLD, and UGLY! am I wrong? or is it really still the best option?
I know of Excel-DNA and it really is perfect for use with C#, but there really is no similar option for C++ - although I've seen some commercial options, for example:
1 http://www.stochastix.com/solutions...latest/features
2. http://www.planatechsolutions.com/xllplus/default.htm
Really appreciate your toughts.
thanks
|
| |
|
Edit/Delete • Quote • Complain |

sma202
Registered: Jun 2010
Posts: 41 |
07-15-12 01:21 AM
Quote from bluematrix:
Hi
I want some expert/experienced advice on the best approach/method of using C++ code in Excel. For example building some pricing models in C++ and using them in Excel.
I know there are various ways so I want your opinion.
It seems there are lot of pages on using COM. but I personally think COM is OLD, and UGLY! am I wrong? or is it really still the best option?
I know of Excel-DNA and it really is perfect for use with C#, but there really is no similar option for C++ - although I've seen some commercial options, for example:
1 http://www.stochastix.com/solutions...latest/features
2. http://www.planatechsolutions.com/xllplus/default.htm
Really appreciate your toughts.
thanks
write a dll and call it in vba using the win32 api.
|
| |
|
Edit/Delete • Quote • Complain |

clearinghouse
Registered: Aug 2010
Posts: 572 |
07-15-12 01:25 AM
Quote from bluematrix:
Hi
I want some expert/experienced advice on the best approach/method of using C++ code in Excel. For example building some pricing models in C++ and using them in Excel.
I know there are various ways so I want your opinion.
It seems there are lot of pages on using COM. but I personally think COM is OLD, and UGLY! am I wrong? or is it really still the best option?
I know of Excel-DNA and it really is perfect for use with C#, but there really is no similar option for C++ - although I've seen some commercial options, for example:
1 http://www.stochastix.com/solutions...latest/features
2. http://www.planatechsolutions.com/xllplus/default.htm
Really appreciate your toughts.
thanks
Use C++/CLI, and recompile your libraries in that, then connect to whatever .NET bindings that Excel-DNA thing is supporting. And if that's not possible, create an assembly with C++/CLI, wrap it in a C# interface and then connect /that/ to Excel-DNA.
|
| |
|
Edit/Delete • Quote • Complain |

bluematrix
Registered: Jan 2012
Posts: 114 |
07-15-12 01:29 AM
ok - saw I have two different options offered already - but which is better?
also have you actually experience doing this? are there any limitations using a dll or going through c# excel-dna? can you use objects exactly the same way etc?
ALSO - what if you have lot of code in non-CLI that might be difficult to recompile..
thanks
|
| |
|
Edit/Delete • Quote • Complain |

clearinghouse
Registered: Aug 2010
Posts: 572 |
07-15-12 01:39 AM
Quote from bluematrix:
ok - saw I have two different options offered already - but which is better?
also have you actually experience doing this? are there any limitations using a dll or going through c# excel-dna? can you use objects exactly the same way etc?
ALSO - what if you have lot of code in non-CLI that might be difficult to recompile..
thanks
I've never had any difficulties recompiling native code in C++/CLI, and C++/CLI seems to link in native libraries and automatically generate the wrapper/transition code to get information out of the native libraries properly.
I use C++/CLI quite a bit, mostly because using COM libraries or various broker interfaces and changing from broker to broker on all the various prop front-ends always involves some random new hodge-podge of Windows-related technology. C++/CLI is somewhat of a god-send because it serves as a sort of glue for connecting old/native code with systems that use .NET.
The added benefit is that you can still write solid, re-usable C++, and not feel bound to .NET forever.
I can't comment on Excel-DNA; I've never used it. I was just proposing an alternative if you didn't want to be forced into C#.
|
| |
|
Edit/Delete • Quote • Complain |

sma202
Registered: Jun 2010
Posts: 41 |
07-15-12 01:47 AM
Quote from bluematrix:
ok - saw I have two different options offered already - but which is better?
also have you actually experience doing this? are there any limitations using a dll or going through c# excel-dna? can you use objects exactly the same way etc?
ALSO - what if you have lot of code in non-CLI that might be difficult to recompile..
thanks
if you have c++ dlls already, making a call via win32 is straightforward and would be the fastest way.
If you want to abstract things in a pretty manner and don't mind learning cli...go with that route.
|
| |
|
Edit/Delete • Quote • Complain |
| Receive
an email whenever a new post is added to this thread by subscribing
to it. |
|
|
|
|