FORUMS BROKERS SOFTWARE
Home
 
    Forums > Technically Speaking > Programming > C++ use in Excel - best option?


Reply
 
Thread Tools
Old Jul 14th, 2012, 07:44 PM   #1
bluematrix
 
 
Join Date: Jan 2012
Posts: 146
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/...atest/features
2. http://www.planatechsolutions.com/xllplus/default.htm


Really appreciate your toughts.

thanks
    Quote
Old Jul 14th, 2012, 08:21 PM   #2
sma202
 
 
Join Date: Jun 2010
Posts: 42
Quote:
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/...atest/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.
    Quote
Old Jul 14th, 2012, 08:25 PM   #3
clearinghouse
 
 
Join Date: Aug 2010
Posts: 572
Quote:
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/...atest/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.
    Quote
Old Jul 14th, 2012, 08:29 PM   #4
bluematrix
 
 
Join Date: Jan 2012
Posts: 146
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
    Quote
Old Jul 14th, 2012, 08:39 PM   #5
clearinghouse
 
 
Join Date: Aug 2010
Posts: 572
Quote:
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#.
    Quote
Old Jul 14th, 2012, 08:47 PM   #6
sma202
 
 
Join Date: Jun 2010
Posts: 42
Quote:
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.
    Quote
 
Reply
Thread Tools

Forum Jump



   Conduct Rules   Privacy Policy   Sitemap Copyright © 2014, Elite Trader. All rights reserved.   

WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Trading & Clearing
Alpha 7 Trading Academy
Proprietary Trading Education
AMP Global Clearing
Futures and FX Trading
Bright Trading
Professional Equities Trading
CTS
Futures Trading Software
DaytradingBias.com
Professional Trading Analytics
ECHOtrade
Professional Trading Firm
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
MultiCharts
Trading Software Provider
NinjaTrader
Trading Software Provider
OANDA
Currency Trading
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thinkorswim by TD Ameritrade
Direct Access TradingAdvertisement
TradersStudio
System Building & Backtesting
Trading Technologies
Trading Software Provider
Trend Following
Trading Systems Provider