1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to write an FS module

Discussion in 'Tools programming' started by lordofwings, 10/6/07.

  1. lordofwings

    lordofwings

    Joined:
    5/11/06
    Messages:
    559
    Country:
    panama
    I would like to get some pointers as to how to write a module for FS (FS9/FSX), that would be a DLL that runs as part of the simulator.

    Then the logical question for me would also be, is it possible to write such a DLL in C# rather than C++ ? and if not, perhaps a C++ bootstrap that would invoke functionality of another DLL which is written in C#? that assuming I can use Visual C++ 2005 Express.
  2. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    20,465
    Country:
    netherlands
    Hi,

    As far as I know most part of the modules is C code, don't think it is possible to use C# (or any other managed code). Have a look around this forum (I moved this post into the tools programming forum), there are some other threads about this subject.
  3. FlapsOut

    FlapsOut

    Joined:
    29/5/07
    Messages:
    75
    Country:
    us-texas
    Calling C# code from C++

    Hi LoW,

    I suggest you read this:
    http://www.dotnet247.com/247reference/msgs/20/103481.aspx

    It suggests two options for calling managed C# code.
    1) Use TLBExp to export C# classes as COM objects. (Not all C# classes can
    be exported to COM)
    2) Compile C++ code that need to call any .NET classes with the /CLR
    compiler option (compile to managed code - MSIL). Then use #using
    "<AssemblyName>.dll" to reference the .NET assembly, and simply use the .NET classes using C++ with the Managed Extensions.

    If your programming primarily in C#, I don't see why you would want to do that.

    If your programming primarily in C++ and wanted to use classes that were written to a C# assembly, then you would want to do this.

    FlapsOut
  4. jcboliveira

    jcboliveira

    Joined:
    8/6/04
    Messages:
    150
    Country:
    portugal
    Just put FSX launching the exe. If you do a managed program without forms it will work just like a dll. Unless you are trying to do things that need to be in FS env.

    José
  5. lordofwings

    lordofwings

    Joined:
    5/11/06
    Messages:
    559
    Country:
    panama
    RE: Writing an FS module

    Well, I wouldn't want to use C++. I have used it a lot in the past but nowadays I am a C# guy and I typically don't like to look back. So it was not why I wanted to do it but how would I do it if I were FORCED to do it.

    The reason behind all this is that I am writing an add-on in managed code. I can connect to FS and monitor things but it does have a form. I need the form to pop up in the cockpit so that the user can interact with my add-on. That was why I need(ed) to find out how I could do that.

    At the moment it is just FS9 but when it is done I will make the necessary changes to make it FSX compatible as well.

Share This Page