Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. re-using old code. C++, Fortran

re-using old code. C++, Fortran

Scheduled Pinned Locked Moved C#
tutorialcsharpc++question
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Ylno
    wrote on last edited by
    #1

    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........

    D L 2 Replies Last reply
    0
    • Y Ylno

      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........

      D Offline
      D Offline
      Dan Neely
      wrote on last edited by
      #2

      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

      Y 1 Reply Last reply
      0
      • D Dan Neely

        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

        Y Offline
        Y Offline
        Ylno
        wrote on last edited by
        #3

        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.

        D 1 Reply Last reply
        0
        • Y Ylno

          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........

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          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

          Y 1 Reply Last reply
          0
          • Y Ylno

            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.

            D Offline
            D Offline
            Dan Neely
            wrote on last edited by
            #5

            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

            Y 1 Reply Last reply
            0
            • D Dan Neely

              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

              Y Offline
              Y Offline
              Ylno
              wrote on last edited by
              #6

              Thanks Dan

              1 Reply Last reply
              0
              • L led mike

                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

                Y Offline
                Y Offline
                Ylno
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups