- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Is it possible to call a subroutine whose name is in a variable?
Let's say for example I have a character array with the string 'MYFUNCTION' in it, I would like to issue an instruction that does the same as ' CALL MYFUNCTION ( blabla ) '
Thanks, Michael
Let's say for example I have a character array with the string 'MYFUNCTION' in it, I would like to issue an instruction that does the same as ' CALL MYFUNCTION ( blabla ) '
Thanks, Michael
Lien copié
3 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Not in a portable way but certainly doable, the manner dictated by the target platform. The best method depends on why you want to do this. Generally making some sort of dispatch function which accepts "MYFUNCTION" as an argument can be used while keeping things relatively generic though.
James
James
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thanks for your answer. I will try to explain what we want to do:
The idea is to have a library of components that simulate the behaviour of thermal systems. These components are in DLL libraries and each component coresponds to a FORTRAN routine (e.g. one routine simulates a boiler, another routine simulates a heat exchanger).
The user creates a simulation scheme (you can see it as a text file with the names of the routines, their parameters and the way they are connected to each other) One instruction in the file could be that we have to call the "BOILER" routine with some parameters.
Ideally, every user could add libraries with new modules and so we need a way to be able to look into all DLL's in a given folder if a given routine exists, and then call it.
Thanks,Michael
The idea is to have a library of components that simulate the behaviour of thermal systems. These components are in DLL libraries and each component coresponds to a FORTRAN routine (e.g. one routine simulates a boiler, another routine simulates a heat exchanger).
The user creates a simulation scheme (you can see it as a text file with the names of the routines, their parameters and the way they are connected to each other) One instruction in the file could be that we have to call the "BOILER" routine with some parameters.
Ideally, every user could add libraries with new modules and so we need a way to be able to look into all DLL's in a given folder if a given routine exists, and then call it.
Thanks,Michael
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You'd have to use dynamic binding of dll routines (LoadLibrary/GetProcAddress), which requires that dll's lib file is not linked with the calling module, and routines are referenced by dll name and routine name. See
this recent thread.
this recent thread.
Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable