Common interface for mixed-language DLL

Common interface for mixed-language DLL

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.

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.


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?

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.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today