UDF/RTD memory share

Add-in Express™ Support Service
That's what is more important than anything else

UDF/RTD memory share
How to share objects between UDF in XLL and functions in RTD Server 
Andrey Glozman




Posts: 1
Joined: 2010-03-15
Greetings,
I am a newbie in Excel RTD/XLL development. I found a forum topic here [http://www.add-in-express.com/forum/read.php?FID=5&TID=4898&MID=24399#message24399], with a suggestion to share code between XLL and RTD functions.

How to do that?

I need to have a shared object (Hashtable) that will be initiated by UDF and then monitored by RTD.


Thanks in advance,
Andrey
Posted 15 Mar, 2010 22:08:15 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Andrey,

That post suggests sharing code, not object created in code. To share such an object, you can try the following approach:
- in the code of the RTD server you get the current instance of Excel via Marshal.GetActiveObject
- then you call ExcelApp.Evaluate("MyXLL.MyHiddenMethod"). "MyHiddenMethod" is described in the corresponding ADXExcelFunctionDescriptor in your XLL module and has IsHidden=True.

If the info required for the creation of the hashtable can be passed to the RTD server, you could create the hashtable in the code of the RTD server. To hide passing that info from the user, you could wrap the corresponding call by a method of your XLL as shown in http://www.add-in-express.com/docs/net-excel-udf-tips.php#advanced-rtd.


Andrei Smolin
Add-in Express Team Leader
Posted 16 Mar, 2010 09:01:16 Top