CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   CFX 10 User Routine NOT in Fortran (

Andre July 28, 2006 03:49

CFX 10 User Routine NOT in Fortran

I got a DLL on a windows system which provides some functions I like to include in CFX 10. The DLL has been written in Delphi not in FORTRAN.

To include one of the functions in CFX 10 I created a User Routine, which names the function name provided by the DLL, the dll name and the dll path: User Routine - hallowelt Option User CEL Function Calling Name: helloworld Library Name: testdll Library Path: C:\cfxwork\ Working Path: C:\cfxwork

The dll file is located in C:\cfxwork\winnt where CFX10 expects the dll.

I also created a User Funktion, which supports the Argument and Result Units.

When I run the solver I get the error message: Error message number: 001100279 Message: Unable to load symbol helloworld from D:\cfxwork\winnt\testdll.dll: Die angegebene Prozedur wurde nicht gefunden. (named procedure not found)

In the DLL the Symbol 'helloworld' ist defined.

What is wrong about my User Routine? Is it possible to include Delphi-DLLs in CFX 10?

Any hints are appreciated. Greets Andre

Mike July 28, 2006 13:22

Re: CFX 10 User Routine NOT in Fortran
No it's not possible! User Fortran only, there's no User Delphi. Mike

opaque July 28, 2006 14:25

Re: CFX 10 User Routine NOT in Fortran
Dear Andre,

It is not clear what you are trying to do.. Who is calling the function within the Delphi dll, the ANSYS CFX solver, or your User CEL Function?

Also, do you know what is the name the Delphi dll is exporting? Assuming is exporting that function... One thing is the routine name, and another is what the name within the ddl is..

Not trivial,


Jeff July 28, 2006 19:42

Re: CFX 10 User Routine NOT in Fortran
Going way out on a limb here, but this "may" be possible.

If you create a user FORTRAN routine that links into CFX appropriately, you "may" be able to delare your DLL routine as an external routine in the fortran and call it from there. This will make your user FORTRAN a sort of "wrapper" for the DLL written in Delphi. The other trick is that you have to know the parameter passing protocol for Delphi and set it up appropriately in the external declaration.

I've done something similar with C++ and FORTRAN, but not with CFX attached. This is not easy and you'll need to do a lot of digging in the Delphi and FORTRAN documenation for how to make this work.

It's probably easier to re-write the routine in FORTRAN!


Johnson July 31, 2006 02:36

Re: CFX 10 User Routine NOT in Fortran
I'm not sure how you've created your dll, but I think you need to build a new dll that contains the Delphi library routines and your User CEL routine.

You can do this using cfx5mkext by declaring the Delphi library (or any other library) on the command line with the -L option, for example:

cfx5mkext -name NewLib myRoutine.F -L/home/user/delphi.lib

or similar. I've done this before with C libraries built externally.


Andre July 31, 2006 03:06

Re: CFX 10 User Routine NOT in Fortran
I try to create a User Routine calling the Delphi DLL. But to use the User Routine I have to create a CEL Function.

IMHO the solve have to call the user routine via the user CEL function.

Yes I know the exportet name of the function inside the DLL and I also know the 'inside' name.

In Delphi the function is exportet with the command: exports Helloworld name 'Hello';

The Helloworld is the inside function name and Hello is the exportet name (symbol?)


Andre July 31, 2006 03:19

Re: CFX 10 User Routine NOT in Fortran
I am using a Windows System so I had to adapt the parameters of the cfx5mkext.

cfx5mkext could not find the compiler command 'df'. I use the open Watcom F77 compiler. Do I need some special FORTRAN compiler to use cfx5mkext?



Andre July 31, 2006 03:21

Re: CFX 10 User Routine NOT in Fortran
OK. But where is the difference between a library created with FORTRAN and a library created with Delphi?

There are functions exported and I want to call one of these. I know the parameter phrase and their order.

So what is different so that CFX can't use the Delphi DLL?


Andre July 31, 2006 03:31

Re: CFX 10 User Routine NOT in Fortran
I also know the parameter order and I can modify the parameter order within the Delphi DLL.

Which parameter passing protocol is used by CFX?


Johnson August 1, 2006 07:28

Re: CFX 10 User Routine NOT in Fortran
Compaq Visual Fortran (formerly Digital Fortran) v6.6a is the supported compiler for Ansys CFX 10.0 on Windows.

If you have Linux, the freely available g77 will work for most situations.


Mike August 1, 2006 07:55

Re: CFX 10 User Routine NOT in Fortran
If you're thinking of buying a compiler for Windows, go with the Intel Fortran compiler. It can be made to work with version 10 and will be the official compiler for 11. Mike

TobiasZ August 1, 2006 10:20

Re: CFX 10 User Routine NOT in Fortran
I've heard from ANSYS helpdesk that it is a bit more tricky to install Intel Visual Fortran (if on Windows), if used for CFX-10. For CFX-11 it should be much easier, about the same procedure as for Compaq for CFX-10, but still - the Compiler also additionally needs the linker Intel Visual Studio 2003, which was not the case for Compaq. TobiasZ

HekLeR August 8, 2006 22:57

Re: CFX 10 User Routine NOT in Fortran
yep, it's a bit tricky with cfx 10 because

- you have to manually change the "etc/cfx5mkext.ccl" file. - you have to install a bunch of other stuff in addition to the intel compiler to make it work :( eg: .net 2003 linker, some other toolkit I can't remember if you use functions like exp(),...

HekLeR August 8, 2006 22:58

Re: CFX 10 User Routine NOT in Fortran
I would add that with CFX 11 you only do not have to modify the cfx5mkext.ccl file. The other stuff about the compiler still applies.

HekLeR August 8, 2006 23:03

Re: CFX 10 User Routine NOT in Fortran
To call your delphi function you only need:

- compile your fortran routine with CVF 6.6 (supported fortran compiler on windows, others will not work) - include the delphi dll on the cfx5mkext command line - figure out what name mangling scheme is used so that you can export the correct symbol from your delphi dll - figure out if your fortran is passing by reference or value so you can correctly recieve the arguments (pointers or values!) - figure out if your fortran is passing hidden string lengths contained in the argument list or at the end (only really matters if you pass strings into your delphi functions)

All times are GMT -4. The time now is 20:50.