Software Archive
Read-only legacy content
17061 Discussions

CALLDVF and ALIASing

bdrichards
Beginner
270 Views
I have been using CVF-created dll's from Delphi-created apps for about a year and everything seems to be operating OK. However, in the new CALLDVF (from Delphi) example it states that Dephi prepends an underscore and so the Fortran function (or procedure) needs to be appropriately ALIASed. None of my functions are so ALIASed and there has never been a problem. I'm confused...
Bill D. Richards
North Idaho College
0 Kudos
2 Replies
Steven_L_Intel1
Employee
270 Views
I'm not familiar with Delphi - I see that the CALLDVF example expects Delphi to use the C naming conventions (downcased name and prepended underscore) but the STDCALL calling conventions. Strange. Perhaps it depends on what your Delphi code looks like?

Steve
0 Kudos
bdrichards
Beginner
270 Views
Here is a sample of the Delphi function declaration (after reading the Delphi reference, which has a great section on parameter passing conventions, I declared all function calls as STDCALL):
  
Function FDSCANSHEET(sheet : pchar;  
 lsheet : integer;  
 id : pchar;  
 lid : integer;  
 pform : pchar;  
 lform : integer;  
 Var iside : integer;  
 Var iessay : integer) : integer; stdcall; external 'par.dll';  


and the fuinction in CVF is as:

  
  
INTEGER function fdScanSheet(s1,id,form,side,essaypts)  
 use scanstuffmodule  
 use dflib  
 character(LEN=*),intent(INOUT) :: s1,id,form  
 integer(4),intent(INOUT) :: side,essaypts  
 !DEC$ ATTRIBUTES DLLEXPORT :: FDSCANSHEET  
 !DEC$ ATTRIBUTES ALIAS:'FDSCANSHEET' :: FDSCANSHEET  
  


I guess the STDCALL convention seems to be the best for me, you still have to make sure of the case of the function name, though.

Bill
0 Kudos
Reply