re-using old code. C++, Fortran
-
Hello, Can someone point me towards a good tutorial which will walk me through how to use C++ and Fortran code with/from C#. Is it possible for me to use the object-files produced when compiling C++/Fortran and use them in C#? I'm looking to put a nice GUI around some old code. Thanks........
-
Hello, Can someone point me towards a good tutorial which will walk me through how to use C++ and Fortran code with/from C#. Is it possible for me to use the object-files produced when compiling C++/Fortran and use them in C#? I'm looking to put a nice GUI around some old code. Thanks........
You can use C/C++ built DLLs in C#. Look into p/invoke. Assuming the fortran code was compiled into c++ compatible DLLs as well you could you it as well.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop. -- Matthew Faithfull
-
You can use C/C++ built DLLs in C#. Look into p/invoke. Assuming the fortran code was compiled into c++ compatible DLLs as well you could you it as well.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop. -- Matthew Faithfull
hi thanks for the reply. I did look into DLLs but i didn't get one to work. do you have a tutorial link on DLLS? Is there an easy way to create C++ compatible DLLs using Fortran code? And can classes get incorporated into DLLs? or just methods? Is it not possible to use the object files then? I'd rather not translate the Fortran.
-
Hello, Can someone point me towards a good tutorial which will walk me through how to use C++ and Fortran code with/from C#. Is it possible for me to use the object-files produced when compiling C++/Fortran and use them in C#? I'm looking to put a nice GUI around some old code. Thanks........
Ylno wrote:
Is it possible for me to use the object-files produced when compiling C++/Fortran and use them in C#?
It might be possible. If it is possible it would likely be easier to accomplish if you knew about Computer Programming.[^] The process of writing source codes requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms, and formal logic.
led mike
-
hi thanks for the reply. I did look into DLLs but i didn't get one to work. do you have a tutorial link on DLLS? Is there an easy way to create C++ compatible DLLs using Fortran code? And can classes get incorporated into DLLs? or just methods? Is it not possible to use the object files then? I'd rather not translate the Fortran.
Assuming you have the source available the pinvoke wizard should be able to help with getting the declarations to do the import correct. http://www.paulyao.com/resources/tools/pinvoke.asp[^] I suggest looking for a fortran board for assistance with getting DLLs that can be called by standard win32 applications. This isnt a good place to try and find someone with that skill. You can import structs, classes, and stand alone function calls from a native dll. You can't use object files. They're a semi compiled format and native code can't be directly compiled into managed code. You need dlls. If you can use the obj files in a windows C/C++ compiler you should be able to create a dll containing all of thier functionality for use via p/invoke.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop. -- Matthew Faithfull
-
Assuming you have the source available the pinvoke wizard should be able to help with getting the declarations to do the import correct. http://www.paulyao.com/resources/tools/pinvoke.asp[^] I suggest looking for a fortran board for assistance with getting DLLs that can be called by standard win32 applications. This isnt a good place to try and find someone with that skill. You can import structs, classes, and stand alone function calls from a native dll. You can't use object files. They're a semi compiled format and native code can't be directly compiled into managed code. You need dlls. If you can use the obj files in a windows C/C++ compiler you should be able to create a dll containing all of thier functionality for use via p/invoke.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop. -- Matthew Faithfull
-
Ylno wrote:
Is it possible for me to use the object-files produced when compiling C++/Fortran and use them in C#?
It might be possible. If it is possible it would likely be easier to accomplish if you knew about Computer Programming.[^] The process of writing source codes requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms, and formal logic.
led mike
Thanks led mike. I did think about learning programming but I thought I'd try C# first. I guess it's time to bite the bullet.
led mike wrote:
It might be possible. If it is possible it would likely be easier to accomplish if you knew about Computer Programming.[^]
-- that's exactly the type of comment that makes people stay away.