CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > CFX

CFX 10 User Routine NOT in Fortran

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 28, 2006, 03:49
Default CFX 10 User Routine NOT in Fortran
  #1
Andre
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
  Reply With Quote

Old   July 28, 2006, 13:22
Default Re: CFX 10 User Routine NOT in Fortran
  #2
Mike
Guest
 
Posts: n/a
No it's not possible! User Fortran only, there's no User Delphi. Mike
  Reply With Quote

Old   July 28, 2006, 14:25
Default Re: CFX 10 User Routine NOT in Fortran
  #3
opaque
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.

  Reply With Quote

Old   July 28, 2006, 19:42
Default Re: CFX 10 User Routine NOT in Fortran
  #4
Jeff
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
  Reply With Quote

Old   July 31, 2006, 02:36
Default Re: CFX 10 User Routine NOT in Fortran
  #5
Johnson
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
  Reply With Quote

Old   July 31, 2006, 03:06
Default Re: CFX 10 User Routine NOT in Fortran
  #6
Andre
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

  Reply With Quote

Old   July 31, 2006, 03:19
Default Re: CFX 10 User Routine NOT in Fortran
  #7
Andre
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

  Reply With Quote

Old   July 31, 2006, 03:21
Default Re: CFX 10 User Routine NOT in Fortran
  #8
Andre
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
  Reply With Quote

Old   July 31, 2006, 03:31
Default Re: CFX 10 User Routine NOT in Fortran
  #9
Andre
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

  Reply With Quote

Old   August 1, 2006, 07:28
Default Re: CFX 10 User Routine NOT in Fortran
  #10
Johnson
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
  Reply With Quote

Old   August 1, 2006, 07:55
Default Re: CFX 10 User Routine NOT in Fortran
  #11
Mike
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
  Reply With Quote

Old   August 1, 2006, 10:20
Default Re: CFX 10 User Routine NOT in Fortran
  #12
TobiasZ
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
  Reply With Quote

Old   August 8, 2006, 22:57
Default Re: CFX 10 User Routine NOT in Fortran
  #13
HekLeR
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(),...
  Reply With Quote

Old   August 8, 2006, 22:58
Default Re: CFX 10 User Routine NOT in Fortran
  #14
HekLeR
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.
  Reply With Quote

Old   August 8, 2006, 23:03
Default Re: CFX 10 User Routine NOT in Fortran
  #15
HekLeR
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)

  Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to access each cell of a face? (user fortran) Katariina CFX 3 January 28, 2008 10:16
User fortran error when running CFX-10 in parallel CFDworker CFX 2 October 26, 2007 16:01
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 09:32
how to use USER FORTRAN with CFX cfd_99 Main CFD Forum 1 June 4, 1999 05:42


All times are GMT -4. The time now is 00:03.