Sign in to follow this  
Guest Joris

Modules for FS9 (More specific: ITrafficInfo)

Recommended Posts

Hi fellow developersI'm experimenting with c++ and tried to write a module for fs9. With the help of some examples found on the internet this worked quite ok.I don't succeed using the itrafficinfo though: when I tried to include gauges.h and itrafficinfo.h kinda everything went wrong. Seems like I just can't connect to FS like this:extern "C" __declspec (dllexport) LINKAGE Linkage ={ 0x00000654, module_init, module_deinit, 0, 0, 0x0900,};extern "C" __declspec (dllexport) IMPORTTABLE ImportTable ={ { 0x00000000, NULL }};and then call this:IPanelCCallback* pPanelCallback = panel_get_registered_c_callback(TRAFFIC_INFO_INTERFACE_NAME);I'd be glad if anyone could point this out for me (using gauges.h and itrafficinfo.h in a module, what needs to be declared where, etc).ThanksJoris

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

My inner core of FS9 modules looks likes this, I never tried to acces the TrafficInfo interface from a module though, only from gauges.void FSAPI ModuleInit(void){...}void FSAPI ModuleDeinit(void){...}//-------------------------------------------------------------------------------------------------------BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) { ... } /* This is the module's import table. */ GAUGESIMPORT ImportTable = { { 0x0000000F, (PPANELS)NULL }, { 0x00000000, NULL } }; /* This is the module's export table. */ GAUGESLINKAGE Linkage = { 0x00000001, ModuleInit, ModuleDeinit, 0, 0, FS9LINK_VERSION, NULL};If I recall that right you need 0x00000001 for full access to all functions of the PANELS structure (ImportTable), other numbers like 0x00000000 limit the functionality and all ..._register_c_callback functions are part of the "higher" ImportTable functions. Also ImportTable has to be properly set up with both entries, to get ImportTable at all which you need for calling any function out of it (most FS functions that are not part of the image structure itself, are macros extending the ImportTable members).Arne Bartels

Share this post


Link to post
Share on other sites

Thanks Arne, I got it working now. I thought the 0x00000001 had to be a unique identifier, that's mistake 1 and mistake 2 I was exporting my own tables instead of using those provided in the gauges.h. Also the iTrafficInfo works now...Thanks!!Joris

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this