Jump to content
Sign in to follow this  
WarpD

gauges.h outside of cgauge

Recommended Posts

Guest steels214

HiI'm trying to figure out how to use the gauges.h functions outside of a cgauge. I've been looking at the cabincomfort.dll as an example. I can get my program to compile but it crashes at runtime. Here is the outline of my .exe program:// application.cpp#include "GAUGES.H"PPANELS Panels = NULL;GAUGESIMPORT ImportTable = { 0x0000000F, (PPANELS)NULL }, { 0x00000000, NULL } }; void FSAPI module_init(void){ if (NULL != Panels) { ImportTable.PANELSentry.fnptr = (PPANELS)Panels; }} void FSAPI module_deinit(void){}// This is the module's export table.GAUGESLINKAGE Linkage = { 0x00000013, module_init, module_deinit, 0, 0, FS9LINK_VERSION, { 0 }};int main(){ check_named_variable("my_named_variable");}//////////////////////////////////////////////////////////////////////////////This code will at least compile, but crashes at runtime. When I get to check_named_variable(), I get an access error.I basically just copied everything before main() from the cabincomfort.cpp. if I comment out all the definitions before main() I get this error: unresolved external symbol _ImportTableCan anybody tell me what I'm missing here?Thanks

Share this post


Link to post
Share on other sites

You can't do that.The function addresses you're wanting to use are filled in by FS when it loads the gauge header.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
Guest steels214

But I can call the check_named_variable() from the cabincomfort.cpp and it works. Is it because that is a dll and I'm trying to do it from a .exe?

Share this post


Link to post
Share on other sites

>But I can call the check_named_variable() from the>cabincomfort.cpp and it works. Is it because that is a dll>and I'm trying to do it from a .exe?In a word, yes. A .dll is loaded by the sim and still runs "in process" unlike an external app running as an .exe "out of process."You will need to use FSX SimConnect if you wish to interface an .exe and the sim.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest steels214

Thanks Bill I'm trying to read/write to a user defined gauge variable from outside the gauge itself. So it looks like I can do this using the gauge functions only from within a dll. I was hoping to be able to do this from an exe too. I tried something like this:SimConnect_AddToDataDefinition(hSimConnect, DEFINITION__NUMBER,"my_number", "int"); my_number being a gauge variable I defined. I get a simconnect exception 'name_unrecognized' by doing this. So my question is, is there any way to write directly to a user defined gauge variable from an exe? Thanks againBobby

Share this post


Link to post
Share on other sites

SimConnect only understands FS variables. User defined variables are not part of FS.There is another forum for SimConnect discussions, because SimConnect is not normally used inside a gauge.


Ed Wilson

Mindstar Aviation
My Playland - I69

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...