[comp.sys.mac.programmer] compiling your own Excel

engber@thylacine.CS.WISC.EDU (Mike Engber) (07/27/89)

The new version of Excel, 2.2, advertises that you can compile functions
and import them for use in Excel. Any of the 2.2 owners care to comment?
 - is it documented in the manual (if not how do you get docs)
 - what all is involved 
 - can functions accept/return array arguments
 - can I use LightSpeed Pascal or C or will I need MPW

It sounds like a really nice feature, but I haven't heard anything about it
except for one sentence in my upgrade letter so I'm suspicious.

-ME

t-atulb@microsoft.UUCP (Atul Butte) (07/28/89)

In article <8007@spool.cs.wisc.edu> engber@thylacine.CS.WISC.EDU (Mike Engber) writes:
>
>The new version of Excel, 2.2, advertises that you can compile functions
>and import them for use in Excel. Any of the 2.2 owners care to comment?
> - is it documented in the manual (if not how do you get docs)
> - what all is involved 
> - can functions accept/return array arguments
> - can I use LightSpeed Pascal or C or will I need MPW
>
>It sounds like a really nice feature, but I haven't heard anything about it
>except for one sentence in my upgrade letter so I'm suspicious.
>
>-ME

Don't be suspicious; it's true :-)! I have sent sample external routines
to comp.binaries.mac along with the source code used to produce them.

The sample set of external routines is called the Serial Library, and
with it, you can control the serial ports (i.e. a modem) through
an Excel macro. Along with the external routines is a sample macro
using the routines called CompuServe. This macro, given a list of
stock symbols, will log onto CompuServe and download the latest 
information on those stocks.

Documentation for the library is provided in a Word 4.0 formatted file.
The source code is being distributed in another posting.

I'll try to answer your questions:

You can use either MPW or Think C, Pascal or any compiler
to create the external routines. Each external routine 
must be placed in a CODE resource with a unique number and name.
The CALL macro command opens a resource file and loads in the CODE
resource with the given name. The REGISTER command takes the data
returned by the CALL command and uses it to find the address and
parameters for the external routine.

On page 267 of the Functions and Macros book, you will see a list
of parameter types which the external routines can accept and return.
The only array type available is code K: an array of floating point
values.

Atul Butte
Microsoft Corporation
uunet!microsoft!t-atulb

neilh@microsoft.UUCP (Neil Hoopman) (07/29/89)

In article <8007@spool.cs.wisc.edu> engber@thylacine.CS.WISC.EDU writes:
>
>The new version of Excel, 2.2, advertises that you can compile functions
>and import them for use in Excel. Any of the 2.2 owners care to comment?
> - is it documented in the manual (if not how do you get docs)
> - what all is involved 
> - can functions accept/return array arguments
> - can I use LightSpeed Pascal or C or will I need MPW
>
>It sounds like a really nice feature, but I haven't heard anything about it
>except for one sentence in my upgrade letter so I'm suspicious.
>
>-ME

Yes, Excel 2.2 does offer this feature.  For complete documentation,
call Microsoft Product Support at 206-454-2030.  Route to the Macintosh
Applications group, and ask for the "CALL and REGISTER Application Note."

What they'll send you is a complete description of the feature, with
code examples of each of the data types you can pass.

I know that you can use LightSpeed C or MPW C to write the code resources,
but I don't know about LSP (though I don't see any reason why not.)
With the examples, the only thing it entails is writing the C code
resource to perform the function that you want.

Yes, you can accept and return array arguments to code resources.

If there is interest, I can post some of the CALL/REGISTER functions
that I've written as examples.

Have fun!
--Neil

----------------------------------------------------------------------------
Neil Hoopman - Microsoft Corp.                         uunet!microsoft!neilh
------------------------------                  microsoft!neilh@uunet.UU.NET
"Carpe Diem. Seize the day.         microsoft!neilh@beaver.cs.washington.edu
 Make your lives extraordinary."    ----------------------------------------
 - Dead Poets Society                  Neil?  Neil who?  Posted what?  When?
----------------------------------------------------------------------------

neilh@microsoft.UUCP (Neil Hoopman) (07/29/89)

Looks like Atul beat me to it... I'm sure that between the two of us,
we can get you going with CALL/REGISTER!

----------------------------------------------------------------------------
Neil Hoopman - Microsoft Corp.                         uunet!microsoft!neilh
------------------------------                  microsoft!neilh@uunet.UU.NET
"Carpe Diem. Seize the day.         microsoft!neilh@beaver.cs.washington.edu
 Make your lives extraordinary."    ----------------------------------------
 - Dead Poets Society                  Neil?  Neil who?  Posted what?  When?
----------------------------------------------------------------------------