Importing function

Is there any way to get the procedure address using GetProcAddress which is
exported by __declspec(dllexport) not as extern "C" __declspec(dllexport) .

I don't want to use full decorated (e.g. GetProcAddress(hPluginDll,
"?Initialize@@YAPAVTMyProtocol@@XZ") ) name while loading function.  I don't
want to statically link the my dll.



0
10/6/2003 5:34:39 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
361 Views

Similar Articles

[PageSpeed] 6

The 'decorated' name is the name of the function. Why would you not want to use it?

- Alan

"Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
news:OhlkDADjDHA.556@TK2MSFTNGP11.phx.gbl...
>
> Is there any way to get the procedure address using GetProcAddress which is
> exported by __declspec(dllexport) not as extern "C" __declspec(dllexport) .
>
> I don't want to use full decorated (e.g. GetProcAddress(hPluginDll,
> "?Initialize@@YAPAVTMyProtocol@@XZ") ) name while loading function.  I don't
> want to statically link the my dll.
>
>
>


0
alancarre (52)
10/6/2003 5:40:47 PM
If I compile and link my code using some other compiler like Borland C++,
MSVC 60 etc. It will will work in all cases or not? Is to use 'decorated'
name a good practice?

-------------------------
"Manish Agarwal"- <manishkrishan@hotmail.com>

"Alan Carre" <alancarre@hotmail.com> wrote in message
news:uwdsyDDjDHA.3568@tk2msftngp13.phx.gbl...
> The 'decorated' name is the name of the function. Why would you not want
to use it?
>
> - Alan
>
> "Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
> news:OhlkDADjDHA.556@TK2MSFTNGP11.phx.gbl...
> >
> > Is there any way to get the procedure address using GetProcAddress which
is
> > exported by __declspec(dllexport) not as extern "C"
__declspec(dllexport) .
> >
> > I don't want to use full decorated (e.g. GetProcAddress(hPluginDll,
> > "?Initialize@@YAPAVTMyProtocol@@XZ") ) name while loading function.  I
don't
> > want to statically link the my dll.
> >
> >
> >
>
>


0
10/7/2003 3:32:10 AM
Why would you switch compilers? If you did, then you could re-examine what the
compiler produces and change your string.

However, if you're trying to write something portable (ie. for someone else to
compile), then no it is not good practice. But *in practice*, you know your
compilation environment so you can trust the name. Also, using the decorated name is
basically another way to ensure that the function's returned object is of the correct
type. That is, if you loaded a similar DLL that was compiled for some other version
of the returned class, you might catch a type mismatch immediately (ie. NULL returned
from GetProcAddress). The way to make sure of that could be to change the name of the
object every time you change it's interface (or data). Such as:

class IMyExportedClass0
    {
    void func0 () = 0;
    };

//extend the class...
class IMyExportedClass1 : public IMyExportedClass0
    {
    void func1 () = 0;
    };

and so on, every time you add to the interface.

****

Of course, the other (very similar) alternative is to use a .DEF file and export an
"extern C" (or STDCALL) from your DLL that will return you a PVOID that you trust to
be whatever object you intended to return. You can self-decorate the exported name if
you want to add in your own type checking.

- Alan


"Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
news:#bomzNIjDHA.624@TK2MSFTNGP11.phx.gbl...
> If I compile and link my code using some other compiler like Borland C++,
> MSVC 60 etc. It will will work in all cases or not? Is to use 'decorated'
> name a good practice?
>
> -------------------------
> "Manish Agarwal"- <manishkrishan@hotmail.com>
>
> "Alan Carre" <alancarre@hotmail.com> wrote in message
> news:uwdsyDDjDHA.3568@tk2msftngp13.phx.gbl...
> > The 'decorated' name is the name of the function. Why would you not want
> to use it?
> >
> > - Alan
> >
> > "Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
> > news:OhlkDADjDHA.556@TK2MSFTNGP11.phx.gbl...
> > >
> > > Is there any way to get the procedure address using GetProcAddress which
> is
> > > exported by __declspec(dllexport) not as extern "C"
> __declspec(dllexport) .
> > >
> > > I don't want to use full decorated (e.g. GetProcAddress(hPluginDll,
> > > "?Initialize@@YAPAVTMyProtocol@@XZ") ) name while loading function.  I
> don't
> > > want to statically link the my dll.
> > >
> > >
> > >
> >
> >
>
>


0
alancarre (52)
10/7/2003 5:38:16 AM
Thanks Alan,

Finally I am going to use extern "C" for my function which returns a pointer
to the object of my class type e.g.

extern "C" __declspec(dllexport) MyClass*  GetMyFunc( )
{
    return new MyClass( );
}

or I should return a PVOID

-------------------------
"Manish Agarwal"- <manishkrishan@hotmail.com>

"Alan Carre" <alancarre@hotmail.com> wrote in message
news:%23ib1vUJjDHA.2644@TK2MSFTNGP10.phx.gbl...
> Why would you switch compilers? If you did, then you could re-examine what
the
> compiler produces and change your string.
>
> However, if you're trying to write something portable (ie. for someone
else to
> compile), then no it is not good practice. But *in practice*, you know
your
> compilation environment so you can trust the name. Also, using the
decorated name is
> basically another way to ensure that the function's returned object is of
the correct
> type. That is, if you loaded a similar DLL that was compiled for some
other version
> of the returned class, you might catch a type mismatch immediately (ie.
NULL returned
> from GetProcAddress). The way to make sure of that could be to change the
name of the
> object every time you change it's interface (or data). Such as:
>
> class IMyExportedClass0
>     {
>     void func0 () = 0;
>     };
>
> //extend the class...
> class IMyExportedClass1 : public IMyExportedClass0
>     {
>     void func1 () = 0;
>     };
>
> and so on, every time you add to the interface.
>
> ****
>
> Of course, the other (very similar) alternative is to use a .DEF file and
export an
> "extern C" (or STDCALL) from your DLL that will return you a PVOID that
you trust to
> be whatever object you intended to return. You can self-decorate the
exported name if
> you want to add in your own type checking.
>
> - Alan
>
>
> "Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
> news:#bomzNIjDHA.624@TK2MSFTNGP11.phx.gbl...
> > If I compile and link my code using some other compiler like Borland
C++,
> > MSVC 60 etc. It will will work in all cases or not? Is to use
'decorated'
> > name a good practice?
> >
> > -------------------------
> > "Manish Agarwal"- <manishkrishan@hotmail.com>
> >
> > "Alan Carre" <alancarre@hotmail.com> wrote in message
> > news:uwdsyDDjDHA.3568@tk2msftngp13.phx.gbl...
> > > The 'decorated' name is the name of the function. Why would you not
want
> > to use it?
> > >
> > > - Alan
> > >
> > > "Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
> > > news:OhlkDADjDHA.556@TK2MSFTNGP11.phx.gbl...
> > > >
> > > > Is there any way to get the procedure address using GetProcAddress
which
> > is
> > > > exported by __declspec(dllexport) not as extern "C"
> > __declspec(dllexport) .
> > > >
> > > > I don't want to use full decorated (e.g. GetProcAddress(hPluginDll,
> > > > "?Initialize@@YAPAVTMyProtocol@@XZ") ) name while loading function.
I
> > don't
> > > > want to statically link the my dll.
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


0
10/7/2003 6:21:46 AM
You should return a PVOID. Don't forget though that extern "C" is also slightly
decorated; it will have an underscore character prepended to it. To be absolutely
sure of the funciton name, use a .DEF file.

******

BTW. If you want to "be more like COM", then you could return an error code and pass
in a pointer to a PVOID. Maybe something like:

__declspec(dllexport) BOOL STDCALL GetInterfaceToObject (PVOID* ppMyClass)
    {
    if (some_condition)
        {
        *ppMyClass = new MyClass;
        return TRUE;
        }

    return FALSE;
    }

Then in your EXE (or whatever):

    MyClass* pMyClass = NULL;
    if (GetInterfaceToObject (&pMyClass))
        {
        pMyClass->DoSomething ();
        }

Which is exactly the same thing you do in COM, except there's a generic function
called CoCreateInstance (ie.GetInterfaceToObject) that takes an identifier for the
type, and a PVOID but instead returns a more detailed error code (ie. an HRESULT).

- Alan

"Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
news:#w$7aLKjDHA.4036@tk2msftngp13.phx.gbl...
> Thanks Alan,
>
> Finally I am going to use extern "C" for my function which returns a pointer
> to the object of my class type e.g.
>
> extern "C" __declspec(dllexport) MyClass*  GetMyFunc( )
> {
>     return new MyClass( );
> }
>
> or I should return a PVOID
>
> -------------------------
> "Manish Agarwal"- <manishkrishan@hotmail.com>
>
> "Alan Carre" <alancarre@hotmail.com> wrote in message
> news:%23ib1vUJjDHA.2644@TK2MSFTNGP10.phx.gbl...
> > Why would you switch compilers? If you did, then you could re-examine what
> the
> > compiler produces and change your string.
> >
> > However, if you're trying to write something portable (ie. for someone
> else to
> > compile), then no it is not good practice. But *in practice*, you know
> your
> > compilation environment so you can trust the name. Also, using the
> decorated name is
> > basically another way to ensure that the function's returned object is of
> the correct
> > type. That is, if you loaded a similar DLL that was compiled for some
> other version
> > of the returned class, you might catch a type mismatch immediately (ie.
> NULL returned
> > from GetProcAddress). The way to make sure of that could be to change the
> name of the
> > object every time you change it's interface (or data). Such as:
> >
> > class IMyExportedClass0
> >     {
> >     void func0 () = 0;
> >     };
> >
> > //extend the class...
> > class IMyExportedClass1 : public IMyExportedClass0
> >     {
> >     void func1 () = 0;
> >     };
> >
> > and so on, every time you add to the interface.
> >
> > ****
> >
> > Of course, the other (very similar) alternative is to use a .DEF file and
> export an
> > "extern C" (or STDCALL) from your DLL that will return you a PVOID that
> you trust to
> > be whatever object you intended to return. You can self-decorate the
> exported name if
> > you want to add in your own type checking.
> >
> > - Alan
> >
> >
> > "Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
> > news:#bomzNIjDHA.624@TK2MSFTNGP11.phx.gbl...
> > > If I compile and link my code using some other compiler like Borland
> C++,
> > > MSVC 60 etc. It will will work in all cases or not? Is to use
> 'decorated'
> > > name a good practice?
> > >
> > > -------------------------
> > > "Manish Agarwal"- <manishkrishan@hotmail.com>
> > >
> > > "Alan Carre" <alancarre@hotmail.com> wrote in message
> > > news:uwdsyDDjDHA.3568@tk2msftngp13.phx.gbl...
> > > > The 'decorated' name is the name of the function. Why would you not
> want
> > > to use it?
> > > >
> > > > - Alan
> > > >
> > > > "Manish Agarwal" <manishkrishan@hotmail.com> wrote in message
> > > > news:OhlkDADjDHA.556@TK2MSFTNGP11.phx.gbl...
> > > > >
> > > > > Is there any way to get the procedure address using GetProcAddress
> which
> > > is
> > > > > exported by __declspec(dllexport) not as extern "C"
> > > __declspec(dllexport) .
> > > > >
> > > > > I don't want to use full decorated (e.g. GetProcAddress(hPluginDll,
> > > > > "?Initialize@@YAPAVTMyProtocol@@XZ") ) name while loading function.
> I
> > > don't
> > > > > want to statically link the my dll.
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


0
alancarre (52)
10/7/2003 9:45:57 AM
Reply:

Similar Artilces:

Integration Manager imports
Hi all I have a legacy data import file, which I've imported into a SQL table, that is at a detailed level. The batch for Dynamics needs to at a summarised level, this I have done as a SQL query. Which leads me to the question... As each posting type has an opposite contra amount against a different account, what is the best way to setup an Integration? Sorry for the rambling, just trying to get my head around verifying the import process. Cheers What type of integration would this be ie payables trans, receivables, GL or Bank? "Charl" wrote: > Hi all > I have a...

Slow import of pictures
When I import pictures while connected to my office network, it is really slow. When I go to my head office which is a few hundred miles away (and where all of the main servers are located), the import is almost instant. Likewise when I disconnect from any network, the import is instant. Why should it make a difference where i am located, especially as all i am doing is importing a picture from my desktop in each instance? Many thanks in advance Right-click *My Computer* click *Disconnect Network drive.* -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ n...

Updating through subform not functioning properly or as desired
I have a problem with a subform not updating with table information after the initial input. First, let me present the setup of the main form creation. 1. I have created a main form (Employee Training) using two tab pages on the form. 2. The first tab (Employee Information) is used to collect data for the primary employee table. 3. The second tab (Job Competency) has an embedded subform to collect training that an employee has received and stores it in a Job Competency table. Here is the problem in the order experience. 1. Starting up the form and entering the employee information o...

VBA passing variables through a function
I have a macro Sub TestMacro(X,Y) ....calculations based on X and Y values End Sub By putting the "X,Y" in the macro, does this make it a function. Because when I try to look for the macro using the macro button on the toolbar the function "TestMacro" does not show up. It shows up when I remove the X,Y. Do you know what has changed? Also i this a good way to program, I want to be able to input values for X and Y so I thought this would be good since I wouldn't have to keep changing the "TestMacro". Sub macro1() X = 7 Y=5 Call TestMacro(X,Y) End su...

Sort Function
I use Excel 2007 quite often for lists and other functions that require sorting. When I set up specific sort orders in a spreadsheet those "orders" do not stay with the spreadsheet when I save the file. In previous versions of Excel when I set up a sort order for a spreadsheet and saved the file when I came back to the file at some later time the sort order was still there. With Excel 2007 I have to re-do the sort order every time I open the file again. Am I doing something wrong? Thanks for your thoughts. Chet OOPS - sorry, messed up, meant to put this in the Excel...

Import multiple photos into excel
I am trying to create a photo sheet that will allow me to import all photos in a directory into an excel spreadsheet. I want it to: Import all images in a directory. (even if I have to choose to open the folder and then select all) Place each photo into a separate box Auto-format all the photos to the same size where (2) images fit on each printed page. Have a space for a text description to the right of each photo. Auto-number each row/photo if possible (so it changes all the numbers if I delete a row) Place a header with a logo on each printed page. Insert a merge field in t...

Can I import my previous message w/o "Folders.dbx"
Hi, I just knew that importing the previous OE mail message requires the file "Folders.dbx". Because I have lost this file, is there any way to import my previous OE5 message / folders to OE6 without checking the file "Folders.dbx"? Symptom: Whenever I try to import the previous mail message, an "Import Message" says - No message can be found in this folder or another application is running that has the required files open. Please select another folder or try closing applications that may have files open. It doesn't work either do I put the previous f...

Excel Function for select data which NOT exist from the list
There are 2 data sets are assumed running in A3 and in B3 down, viz.: In A3 down is: A, B, C, D, E, F, G, H, I, J, K and L In B3 down is: B, A, H, C, F, I, K, J, H, C and J. The result which I want is to list or select the data which is NOT exist in the second set of data (Col B) when compare to the first set of data. In my example, the result is D, E, G, and L actomactic appear in cell C3, C4, C5 and C6 accordingly. I need an Excel formula to have this result! Many thanks, Wilchong -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/excel-new/200804/1 Try thi...

Help to import data from reference workbook
I wasn't sure if this would require VB or not so I've put this in the General Question group. I have 2 workbooks where the first 3 columns of each row (after a title row) consist of an ID number, a North coordinate and an East Coordinate. Workbook A is complete in that every ID for our system is included along with the coresponding North and East coords. Workbook B includes a subset of the IDs and only some of the IDs have their coords in columns B and C. How do I import the coords into Workbook B without having to copy/paste a thousand or more times. Thanks in advance for a...

Import to wrong place
When I imported my .pst I accidently dumped it into "personal folders" choice instead of Outlook Today [personal folders]. Therefore I now have two each of inbox, calendar, notes, etc. The folders under Outlook Today in the folder view are blank. The folders unders the added personal folder is where the information is now. I want to move it all to Outlook Today [personal folders]. I've tried un-install and re-install the entire Office program, but the folder settings end up in the same place. I can move the personal folders to Outlook Today but it won't let me &q...

Looking for help with database functions
I am working with a non-profit rural community development group. We are trying to put together a "database" to put people looking for work together with people needing services. A sample would might be: Joe Blow; [carpenter, woodworker]; free on tues & thur; willing to trade (equal to $10.00 hr); References: Heidi Hoe, 555-5555, John Doh, 555-5555 ext 100 Jane Doe, needing porch repaired and general yardwork, work on your own schedule, open to Barter; References: Seymour Johnson, 555-5555, Ivan Tootall, 555-5555 Winnie Pooh, looking for someone to read news, books, a...

Activating bold function takes time
I have a PC which is having Office XP installed in it. When i try to make a text in a cell bold the first time in any worksheet, it takes aprroximately 4-5 mins, but the very next moment if i want to make another cell bold, it happens as normal. can u help with the reason why it so happens & is there any solution for the same. I also tried reinstalling Office (different version) twice after removing the previous installed version but the problem is still persisting. I think I've read posts that say that when this kind of thing happens, it's usually because the current printe...

FINDING INVOICE FUNCTION ON EXCEL 2002
THERE IS A AUTOMATIC INVOICE FUNCTION UNDER TOOLBAR ON EXCEL 2000. I CANT FIND IT IN EXCEL 2002. IS IT GONE? IF NOT, HOW DO I GET IT. Hi Brian! Posted to worksheet functions: Do a search for Invoice.xlt. Start > Search for Files or Folders Invoice.xlt If you can't find it then you can download from: http://office.microsoft.com/templates/default.aspx?CTT=6&Origin=EC790020111033 Do a search for invoice as there are a few alternatives Best not to post to more than one group or to post in all upper case: Chip Pearson http://www.cpearson.com/excel/newposte.htm -- Regards N...

custom function that reads user information
Hi, I am looking for a custom function that reads some kind of use information (either author name, or even excel registration number that is somehow unique (so best choice might be registration number and that is stored somewhere on a persons computer. I want to incorporate an If statement, so that the function onl returns a proper value if the information read from the person' machine is identical to that specified in the function. Any help is greatly appreciated! a -- Message posted from http://www.ExcelForum.com Check this previous posting http://tinyurl.com/32nuj -- HTH ...

***Important*** Question about check boxes
Hi, I have created a survey in Excel which will be sent via email to a lot of respondents. The survey contains a lot of questions and for each question, they can tick a check box on a scale from 1 to 10 (10 check boxes for each question). How can I enter a validation that only one checkbox may be ticked? What can I do to avoid that users are ticking 2 check boxes (or more) for the same question - only one answer may be given? Can I make use of a po-up as a warning? Or maybe something else? Please help! Thanks! Cheers, Excel-user -- Excel-User -------------------------------------------...

COUNTIF function with date range
Is there anyway to use the COUNTIF function with a date range. I'm trying to count each date within a particular month. For example, =COUNTIF(G5:G100, "12/**/03" And this example with the wildcards is currently not working. Thanks. Amy Hi, Try, =SUMPRODUCT(--(MONTH(G5:G100)=12)) Hope this helps! In article <fd8501c43e96$22a9daf0$a401280a@phx.gbl>, "Amy" <anonymous@discussions.microsoft.com> wrote: > Is there anyway to use the COUNTIF function with a date > range. I'm trying to count each date within a particular > month. For ...

Function to caculate date
Is there a function that will add one or two months to a date in another cell? Example: January 30,2005 in cell A1 in cell A2 March 30,2005 Also is there a function that will add a specific number of days? Example: January 30, 2005 in cell A1 , would like to add 60 days to that Thank you in advance Try this, Jen: =DATE(YEAR(A1), MONTH(A1)+1, DAY(A1)) ******************* ~Anne Troy www.OfficeArticles.com "Jen" <Jen@discussions.microsft.com> wrote in message news:EF8C105C-1516-4EAF-8B43-15260CFDD72F@microsoft.com... > Is there a function that will add one or two months...

Import/Export #2
Is there a way to import/export MS Outlook appt's and other calendar items from one computer to another? E Yes, use the Import and Export Wizard for this located under File -- Roady [MVP] www.howto-outlook.com Tips of the month: -Setting Permissions on a Mailbox -Create an Office XP CD slipstreamed with Service Pack 3 ----- "Ezee" <ezallen001@hawaii.rr.com> wrote in message news:SUyoc.89100$Dn1.3322@fe2.texas.rr.com... > Is there a way to import/export MS Outlook appt's and other calendar items > from one computer to another? > > E > > I hav...

Nested IF function
I think I need a nested IF function, within an IF function. Row 5 Column E- Formula I want Row 5 Column F- 10 Row 5 Column G- 10 Row 6 Column E- Formula I want Row 6 Column F- 10 Row 6 Column G- 9 The first part of the formula I have In E5- IF(F5<F6,"A","B") In E6- IF(F6<F5,"A","B") Formula I want: If the numbers in F5 & F6 are equal, Then it should evaluate the numbers in G5 & G6 to determine "A" or "B" Thanks, Tom picktr@wowway.com P.S - This is comparing two persons and numbers t...

Set date field year to 2005
Hi there, I have a spreadsheet of dates, EG: '10/09/1983', '03/08/1985'. I need to change these all to be in the year 2005, so '10/09/1983' becomes '10/09/2005'. I assumed it would be a case of just doing a custom format DD MMMM 2005 but this doesn't work. Is there an easy worksheet function to do this or will I need to write a macro? Cheers, Chris If it's a one timer you can use formulas =DATE(2005,MONTH(A1),Day(A1)) will take the date in A1 and change the year to 2005 then you can just copy and paste special as values over the old dates, finally...

HOT Reqs : Microsoft Business Solutions | 12+ Months | Chicago, IL (Functional and technical)
HOT Reqs : Microsoft Business Solutions | 12+ Months | Chicago, IL (Functional and technical) ---------------------------------------------------------------------------------------------------------------------------------------------- Microsoft Business Solutions (Microsoft Small Business Financials) Need one resource each for Functional and Technical roles. Location : Chicago, IL Duration : 12+ Months Funtional : This person will be responsible for the requirements gathering and setting up the system. Technical : This person will be responsible for installing and maintaining th...

Trying to build a fixed width file for importing
This is a multi-part message in MIME format. ------=_NextPart_000_000C_01C48A0A.F421FA30 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am trying to build a fixed width file In Excel to import into another = program. The records are 252 (not sure what to call it) bits? of = information long, in several fields. When I build a couple of records = for testing according to the file specs from the program, I am saving = the file as an Excel "space delimited" .PRN file using Courier font. So = far, so good. However, when I open ...

IF function #5
I am having trouble with this function. Here is the formula i am using IF(h=1,C9). What is going on is that when h is not equal to 1 i returns a FALSE reading. Instead of the FALSE statement, i would lik the original number to stay. I want to keep changing h and have th readout look something like this: 1 -143 2 -182 3 -198 4 -199 5 -190 but like i said, when i change h to something other than the number i the formula it gives me the FALSE reading. Can you help. You can emai be at brett.richard@bakeroiltools. Thank -- brett409 --------------------------------------------------------------...

Date Function
I have two different users, who have the same machines and the same version of office. However when one of the users types in a date; i.e - 10/02/2005, and then goes to format the cell, they can click on a date type that will look like; "*Thursday 10 February 2005". However on the second users machine this function is not present, all they have the option of is; "*10 February 2005". I dont know why it is missing of the day?? Can someone please help me? -- andyb7901 ------------------------------------------------------------------------ andyb7901's Profile: http:/...

Returning an Array from a called function within a macro
How do I get a function to return an array. [I know that it should be doable since the various matrix functions return an array.] To be more precise I need to do this within a macro. I know how to do it at the spreadsheet level. I am running Excel 2004 on a MAC [OSX] Thanks Brujolito One way: Public Function foo() As Variant foo = Array(1,2,3,4,5) End Function You can then array-enter the function into, say A1:E1, =foo() to get the values 1->5 into those cells, or use =SUM(foo()) ===> 15 You can obviously get much more complicated... In article &...