• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

wasm Web assembly module

Messages
162
Country
italy
Please,
could someone explain to me what are the real advantages of using a wasm instead of a dll module?
For the moment I don't see them, debugging is limited to code flow, auto and local var values only, but above all the translation from C ++ to wasm is opaque,.
I have tried a piece of c ++ code which is apparently correct and works perfectly when compiled as dll but instead crashes the simulator when compiled as wasm with no possibility of knowing why.
For instance a simple simconnect_open made from a gauge callback makes the sim crash despite the SDK reports is that possible.
It crashes silent even before the C++ debugger can catch the code
I could not make any of my examples work and also the SampleGaugeAircarft example compiled from SDK crashes frequently.
The only gauge i could see working is a simple void gauge :-(
 
Last edited:
Messages
162
Country
italy
thanks for reply,
due my poor english may be i did not made me understood, not meant in general the advantages of a LLVM, but in this particular case, they claim to support legacy C++ modules with so many drawbacks, may be is worth to write directly the code in wasm text using tools to compile /debug the source.
Just my opinion, at present all my effort to write a non-trivial gaugein C++ compiled to a wasm module were unsuccessfull.
 
Messages
162
Country
italy
Just to make an example:
Code:
#include "stdio.h"
#include "ssw_wasm_gauges.h" 
PCSTRINGZ custom_event_id_name = "custom_event_id"; 
struct CustomEventID {    
    ID id;
    ENUM value; 
}; 
CustomEventID custom_event_id = { 0,0 }; 
// Callbacks 
extern "C" {   
 MSFS_CALLBACK bool custom_event_gauge_callback(FsContext ctx, int service_id, void* pData)    {
        switch (service_id)
        {        
case PANEL_SERVICE_PRE_INSTALL: 
       {
            ID id = 0; 
           //custom_event_id.id = register_named_variable(custom_event_id_name);
           id = custom_event_id.id; 
           return true;        
        }        break; 
       case PANEL_SERVICE_POST_INSTALL: 
      // other code void
This code run nicely, it's enough uncomment:
Code:
custom_event_id.id = register_named_variable(custom_event_id_name);
to crash the sim executable, the module that triggers the seems to be ntdll.dll
 
Messages
2,077
Country
us-ohio
Do you have an actual gauge header defined? Without a gauge header, I do not believe that there is any access to the C++ gauge functions. The function is referenced directly from the ImportTable which you have to declare for the sim to be able to populate it. The declaration is automatic if you have a GaugeTable defined using GAUGE_TABLE_BEGIN.
 
Messages
162
Country
italy
Thanks for reply, but things seems quite different, the legacy gauges.h seems not applicable.
Using GAUGE_TABLE_BEGIN. gives compilation errors.
Please may you post a simple example of a gauge ?
tia
 
Top