Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 Discussions

Common interface for mixed-language DLL

Intel_C_Intel
Employee
734 Views
We provide Visual Fortran DLLs to internal and external customers who use Visual Basic, Visual C++ and Delphi. I'm trying to standardize the interface used so that we can accommodate our customers without requiring a lot of work on their part.

My inclination is to mimic the Windows API calls and require VB/Delphi to do likewise. Since both languages support such calls, this choice seems natural. Ideally, I could set up an INTERFACE block in every DLL with all of the DEC$ ATTRIBUTES, etc. preset. Once that is done, providing sample VB declarations, C++ headers, and Delphi definitions would be simplified.

I would appreciate any suggestions the user community has on dealing with these issues.
0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
734 Views
Me again :-). We develop a scientific-calculation dll with reasonably big interface (~100 structure types and ~30 exported functions). The dll is to be called from C++ (on customer's request) or Delphi (our GUI team language). We utilize the following "algorithm":

1) Write the documentation for structure/function in C++ (actually, C) in "Windows API" style. Document the prototype in C there.
2) Paste it to ourdll.h header file.
3) Paste it to ourdll.f90 module (which doesn't contain INTERFACEs to self, but must contain all TYPEs and PARAMETERs). Use a little macro for rough translation C->Fortran, then fix by hand.
4) Translate C header to ourdll.pas using a tool we found on the net (don't have URL at hand, if you need it I'll find it). It does a lot of job but has to be hand-fixed again. (C->Fortran is generally easy to automate, but C->Delphi is tricky due to "reverse syntax".)

For routines generally, we use STDCALL, ALIAS: "_MixedCaseName@n":: MixedCaseName.

As you see, the entire algorithm requires a lot of discipline and care. Unfortunately, I can't provide much helpful advice for routines; we do their translation by hand since INTERFACEs blocks and C declarations are rather dissimilar.

Jugoslav
0 Kudos
rellion
Beginner
734 Views
OK I admit I am a computer moron. But my System Configiration saysI have 3 versions of "Intel Common User Interface" up and running. Is this normal or am I just being paranoid?
0 Kudos
Steven_L_Intel1
Employee
734 Views
That has no connection with the Intel Visual Fortran compiler product - sounds like a motherboard feature. Try asking at the (not affiliated with Intel) ABX Zone Forums.
0 Kudos
Reply