- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have some problems in transplant my code from windows to linux:
1. code such as
!DEC$ ATTRIBUTES DLLEXPORT::xxx
How to change it in linux system?
2. code such as
use ifwin
...
...
hFile = CreateFile("temp.txt"C, GENERIC_WRITE,&
FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0)
ret = SetStdHandle(STD_OUTPUT_HANDLE, hFile)
...
FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0)
ret = SetStdHandle(STD_OUTPUT_HANDLE, hFile)
...
ret=CloseHandle (hFile)
ret=DeleteFile ("temp.txt"C)
ret=DeleteFile ("temp.txt"C)
How to change the code?
Thanks,
Zhanghong Tang
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Linux equivalent of DLL is "shared object". They do not require special directives, just a different way of linking.
Your code uses Windows Win32 API routines, though the ones you show could easily be replaced with standard Fortran OPEN, WRITE and CLOSE statements. You will need to understand what your code is doing and determine if perhaps there are Linux system routines you can use for the same purpose.
Your code uses Windows Win32 API routines, though the ones you show could easily be replaced with standard Fortran OPEN, WRITE and CLOSE statements. You will need to understand what your code is doing and determine if perhaps there are Linux system routines you can use for the same purpose.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
Thank you very much for your reply. In my code, I use windows API function to relocate the screen output to a file. There are many write statements which output data to the screen and I don't want to change all these statements. Is there any subroutine which have the same function as these API functions in windows system?
Thanks,
Zhanghong Tang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not familiar with Linux system calls. It will not be a direct translation. You will have to learn how such things are done on Linux.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Replacement of standard Fortran with API calls is not so commonly done outside of Windows, so you won't find much in the way of examples to go on. You might have to examine how gfortran is implemented, if you wish to know how to do it with linux C. One of the purposes of Windows API calls is to make portability difficult.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page