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

Problems compiling FS9/X Module...

Discussion in 'Tools programming' started by Manuel Ambulo, 1/12/06.

  1. Manuel Ambulo

    Manuel Ambulo

    Joined:
    29/9/06
    Messages:
    162
    Country:
    panama
    Hi,

    Im having problems compiling a FS Module for FS9/X, i had created a Win32 DLL project in VC++ 6, then i upgraded it to VC++ 2005. Because its a module for FS9 and FSX, i had exported the Linkage, and ImportTable (for FS9) in using "extern C __declspec(dllexport)", Also, i included the "SimConnect.h" (for FSX), and everything else. Then i compile, everything goes OK, i got no errors, when i run FS9, i got an error telling me that FS couldnt load the module....then.....LATER...modifying the code, i found that if i remove or dont #INCLUDE the "SimConnect.h" file, (removing all the SimConnect's dependent code...)...and compile, and run FS9, it loads SUCCESSFULLY! the module....***NOW HERE!...IS THE PROBLEM*** i want to include SIMCONNECT in the module because i want the same MODULE (DLL) to run for both FS9/X, ....does anyone had the same problem or is having the same problem?.......

    i was maybe thinking in put somekind of CONDITIONAL statement (IF) at the beginning of the SIMCONNECT.H file, for evaluate the current FS version (using the LINKAGE.MODULEVERSION), so if it is FS9 (0x0900) it just **IGNORE** the content of the SIMCONNECT.H file, OR if it is FSX (0x1000) **READ** the content of the SIMCONNECT.H....................the problem, here is that i dont really know how to do this......if someone could tell me how, then the compatibility problem (of the module) between FS9 and FSX can be solved...

    Best Regards,

    Manuel Ambulo
  2. ziporama

    ziporama

    Joined:
    28/9/06
    Messages:
    203
    Country:
    unitedstates
    Just on a hunch based on your description: it may not be your code at all, it looks to me like you have a referenced DLL that isn't available from the default search path, and therefore FS can't load it, or perhaps load all of the references.

    I would take your compiled module, run it through dependency walker (http://www.dependencywalker.com/) to check out all the dlls it needs and to verify the proper export entry points are there (DllStart(), DllStop(), DllMain()), and make sure that the required files are visible in the search path from the folders where FS9.EXE and FS10.EXE are located. Loading libraries and dependencies has always been a problem, and you may have to resort to the win32 LoadLibrary() API call that lets you specify a path when loading a library in the current process space, that or modifying the PATH environment variable.

    You can easily test the theory by placing all needed dlls in the same folder as the .exe (FS9.exe or FS10.exe) because the first place windows looks when loading a library is the current executing application folder.

    Hope this helps.

    Etienne
    Last edited: 1/12/06
  3. Manuel Ambulo

    Manuel Ambulo

    Joined:
    29/9/06
    Messages:
    162
    Country:
    panama
    THANKS VERY MUCH!, ziporama!, that was the answer!, ........I openned DEPENDENCY WALKER, and saw noticed that SIMCONNECT.DLL was missing, i was using the module in a computer where ONLY FS9 was installed, but i was believing it should work fine without SimConnect.dll, but i see that it needs the functions exported from the SimConnect.dll.....so i installed the SimConnect.dll, using the installer that comes with the FSX SDK, then i had #INCLUDEd the SIMCONNECT.H file, (without any further modification), and all the SimConnect's dependent code, and compiled....and ran FS9, and VOILA!...worked JUST FINE!....so the cause of the problem was the missing SIMCONNECT.DLL.....THANKS! AGAIN!...:)

    Best Regards,

    Manuel Ambulo
  4. lc0277

    lc0277

    Joined:
    25/9/06
    Messages:
    156
    Country:
    france
    Right, but it means that your FS9 users will need to install the simconnect client library, which is a FSX-only feature. Not a technical problem as it can be installed without FSX, but it will probably confuse some of them.
    I wonder if we can import symbols only if FSX is running. You can of course do it by manually loading the simconnect.dll (LoadLibrary()) and then fetching each function GetProcAddress(hm, "SimConnect_Bla") but at the end it will be very boring :eek:
  5. Manuel Ambulo

    Manuel Ambulo

    Joined:
    29/9/06
    Messages:
    162
    Country:
    panama
    Yes, i will then need to include a link for download the SimConnect.msi (installer),...(of course in my website...lol), as it will be required....i think that it can be distributed..(the SimConnect.msi)...i didnt had done anything yet as i need to work a lot for finish the module, but i just want to know if it is allowed to put a link to put available for download for free the SimConnect.msi.....:confused: .....i think it can be re-distributed..as it doesnt requires FSX....

    The idea is to keep one single module for both FSs, so then if i need to update something or fix something...just need to change the code in that project...

    Best Regards,

    Manuel Ambulo
  6. mayhem

    mayhem

    Joined:
    19/1/07
    Messages:
    4
    Country:
    australia
    why not a simple if statment??

    Just come across this post while looking for something else...

    could'nt you wrap the include statement with an if / condition statement..?
    have'nt had need to yet but, guess it works in c++ as well... I use to for PHP.

    So at top / entry point would try and connect to fs9, If no success then include the simconnect.h and try connect to fsx...

    Or does it load it during dll_init..? in that case once referenced it will be a problem...?

    Forgive me if i've overlooked any reasons as to why this may not work as i've been awake a little to long now...zzzz.. We Need A Tired Smiley ----->

    I know you want to keep the one module idea which if possible is always best, But if it does not seem possible or simply to much work.. Then two versions / downloads aint to bad of a things.... For customer means smaller download for each version.... Does'nt need extra code / includes...

    Personally i would rather the little extra work of splitting the module back into half and providing two nice small downloads in return making sure my client is'nt gonna have to download anything but a nice little file.......I Hate downloading something only to find out "another" downloaded is needed..

    If your still having issues with this and would like another persons attempts at it, Let me know.. just cant promise next day response... but normally try to...



    .-:Mayhem Of Code:-.
    http://www.easyasweb.com
    bradmATecps.com.au

Share This Page