|
[Sponsors] |
July 28, 2006, 03:49 |
CFX 10 User Routine NOT in Fortran
|
#1 |
Guest
Posts: n/a
|
Hello,
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 |
|
July 28, 2006, 13:22 |
Re: CFX 10 User Routine NOT in Fortran
|
#2 |
Guest
Posts: n/a
|
No it's not possible! User Fortran only, there's no User Delphi. Mike
|
|
July 28, 2006, 14:25 |
Re: CFX 10 User Routine NOT in Fortran
|
#3 |
Guest
Posts: n/a
|
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, Opaque. |
|
July 28, 2006, 19:42 |
Re: CFX 10 User Routine NOT in Fortran
|
#4 |
Guest
Posts: n/a
|
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! Jeff |
|
July 31, 2006, 02:36 |
Re: CFX 10 User Routine NOT in Fortran
|
#5 |
Guest
Posts: n/a
|
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. Johnson |
|
July 31, 2006, 03:06 |
Re: CFX 10 User Routine NOT in Fortran
|
#6 |
Guest
Posts: n/a
|
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
|
#7 |
Guest
Posts: n/a
|
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? Thanks Andre |
|
July 31, 2006, 03:21 |
Re: CFX 10 User Routine NOT in Fortran
|
#8 |
Guest
Posts: n/a
|
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
|
#9 |
Guest
Posts: n/a
|
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? Andre |
|
August 1, 2006, 07:28 |
Re: CFX 10 User Routine NOT in Fortran
|
#10 |
Guest
Posts: n/a
|
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. Johnson |
|
August 1, 2006, 07:55 |
Re: CFX 10 User Routine NOT in Fortran
|
#11 |
Guest
Posts: n/a
|
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
|
|
August 1, 2006, 10:20 |
Re: CFX 10 User Routine NOT in Fortran
|
#12 |
Guest
Posts: n/a
|
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
|
|
August 8, 2006, 22:57 |
Re: CFX 10 User Routine NOT in Fortran
|
#13 |
Guest
Posts: n/a
|
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(),... |
|
August 8, 2006, 22:58 |
Re: CFX 10 User Routine NOT in Fortran
|
#14 |
Guest
Posts: n/a
|
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.
|
|
August 8, 2006, 23:03 |
Re: CFX 10 User Routine NOT in Fortran
|
#15 |
Guest
Posts: n/a
|
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) |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
User fortran error when running CFX-10 in parallel | CFDworker | CFX | 3 | September 22, 2015 08:59 |
how to access each cell of a face? (user fortran) | Katariina | CFX | 3 | January 28, 2008 09:16 |
Context of user fortran functions | Bloshchitsyn Vladimir | CFX | 0 | October 17, 2007 06:28 |
CFX 10 User Sub Routine | Claudia | CFX | 6 | February 15, 2006 08:32 |
how to use USER FORTRAN with CFX | cfd_99 | Main CFD Forum | 1 | June 4, 1999 05:42 |