Dear Paul, dear Robert:
Mr. Will sent me his files and I have tested them. I noticed that the internal symbol name of his function
F_STDCALL function SQUARE (Number)
Implicit None
Integer :: SQUARE, Number
SQUARE = Number*Number
end
was changed from
__imp__SQUARE@4 (FTN95 v5.20)
to
__imp__SQUARE@8 (FTN95 v5.40)
Mr. Will also sent me his compiler FTN95 configuration:
/132
/CHECK
/COLOUR
/DELETE_OBJ_ON_ERROR
/INTL
/LOGL
/NO_BANNER
/PAUSE_ON_ERROR
/SAVE
/ZEROISE
After testing his dll (built using FTN95 v5.40) it appears to me that although the function should be expecting an INTEGER4 argument (Number) and returning the same type (because of the compiler setting INTL), it is using an INTEGER8 argument and returns an INTEGER*4.
Unfortunately, I have only Excel 2000 running on my system. And I couldn't make his DLL work with this version (due to the lack of an INTEGER*8 type in VB - or at least I didn't find it). I suppose since VB is expecting two arguments because of the symbol's name of the function (__imp__SQUARE@8), it reports an invalid DLL calling convention.
Please find below the relevant information to create the DLL. Of course, I can also send you all the files I set up to analyze the problem. Let me know if you want to have them (my email: support@qtsoftware.de).
Please check. Thank you.
Kind regards,
Joerg Kuthe
www.qtsoftware.de
Here are the commands being used to create the DLL.
ftn95 SQUARE.f90
slink SQUARE_DLL.opt
The file SQUARE_DLL.opt contains this:
dll
load SQUARE
exportall
archive SQUARE.lib
file SQUARE.dll