- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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 kopiert
4 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite