need -mrtd to create Excel DLL?

Lester Ingber ingber@ingber.com
Mon Jul 12 18:47:00 GMT 2004


I was able to create a dll from many C files, representing fairly complex
calculations, using the following in my Makefile, without having to add
any keywords like "__declspec", using info from the Cygwin docs.

I used the following options:
CFLAGS=-g -O2 -Wall -mno-cygwin -mrtd
This DLL tested fine when used by Excel.

(1) I have not seen any postings calling for the use of "-mrtd".
I stumbled across this by trial and error trying to get my DLL to work.
I would prefer to not use this option, given the warnings in `info gcc`:
    ------------8<------------ top cut -> bottom ------------->8------------
`-mrtd'
     Use a different function-calling convention, in which functions
     that take a fixed number of arguments return with the `rtd'
     instruction, which pops their arguments while returning.  This
     saves one instruction in the caller since there is no need to pop
     the arguments there.

     This calling convention is incompatible with the one normally used
     on Unix, so you cannot use it if you need to call libraries
     compiled with the Unix compiler.

     Also, you must provide function prototypes for all functions that
     take variable numbers of arguments (including `printf'); otherwise
     incorrect code will be generated for calls to those functions.

     In addition, seriously incorrect code will result if you call a
     function with too many arguments.  (Normally, extra arguments are
     harmlessly ignored.)

     The `rtd' instruction is supported by the 68010, 68020, 68030,
     68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
    ------------8<------------ bottom cut <- top ------------->8------------
Is there another way?

(2)  I could not get this approach to work using g++, though my code
compiles and runs just fine under an executable branch of code using
either gcc or g++?

Thanks.

Lester



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list