I have posted ExcelDna version 0.18 to the Files section of the
Google Group: http://exceldna.googlegroups.com/web/ExcelDna-0.18.zip.
This version adds support for multi-threaded recalculation in Excel
2007 (http://msdn.microsoft.com/en-us/library/bb687899.aspx). Just
mark your ExcelDna function with IsThreadSafe=true. Of course you need
to ensure that your function really is thread-safe. An example is
pasted below.
If you make calls with high latency, such as calls to a web service or
in the example below, you might like to increase the number of threads
that Excel uses beyond the number of physical processes. This can be
done in the Advanced Options tab. If your functions are compute-
intensive, the optimal number of threads is probably the number of
processors, which is the Excel default setting.
Please also read the notes on ExcelDna version 0.17 (http://
groups.google.com/group/exceldna/browse_thread/thread/
411b44e139a2c1b3), where some breaking changes to the type model for
ExcelDna functions were introduced.
As always, your feedback is appreciated very much.
--Govert--
<DnaLibrary Name="ExcelDna MTR Test AddIn" Language="C#">
<![CDATA[
using System;
using ExcelDna.Integration;
public class MyFunctions
{
[ExcelFunction(Category="MTR Test Functions")]
public static object NonMtrFunction(object arg)
{
return arg;
}
[ExcelFunction(Category="MTR Test Functions",
IsThreadSafe=true)]
public static object MtrFunction(object arg)
{
System.Threading.Thread.Sleep(1000);
return arg;
}
]]>
</DnaLibrary>