Data from flight sim using a dll

Good Day,

I am developing a small home cockpit (as a hobbyist and not as professional) with Microsoft Flight Simulator and the Aerosoft Airbus X. I use a VB.NET app and FSUIPC to connect my hardware to the sim.

Unfortunately this addon is not supported by the FSUIPC so I had to find another way to get the lvars. I have find a sample code (in Airbus X Extended SDK) which act as a gauge (dll) and it is written in C++. I have successfully managed to add new variables to the sample code and had the idea to make them accessible from my VB app. Since I am not familiar with C++, I goggled a lot to figure out how to do it but I have limited success.

When I added the following code to the dll, I can call it (from VB) without problem (as a test).

1
2
3
extern "C" __declspec(dllexport) int addFunc(int a, int b){
	return (a + b);
}

But if I try the code below, I just get "0"

1
2
3
4
extern "C" __declspec(dllexport) double getLVar(int c){
		ND=currentLVARs.NDMode;
	return ND;
}

As I understand the code the lvars are stored in the currentLVARs structure

1
2
3
4
5
6
7
8
9
10
11
12
13
struct structLVARs 
{
	double FMAThrottleMode;
	double NDMode;
	double NDRange;
	double FDstat;
	//....
	//....
	//....
};

//internel structure to hold all LVAR values
structLVARs currentLVARs;

I have no idea how to reach those variables.

I hope you can help me out and thanks in advance.

elektroby


p.s. I am not a native speaker so please forgive me my English
My first question: Do you have any way of being certain that "0" is not the answer you should be getting? Keep in mind that '0.0' is a valid value for a double floating point number and you're retrieving a value as opposed to calculating one.

Next question: What fills in 'currentLVARs' and is it being called\initialized correctly before you call "getLVar()"?

Possibly unrelated link: https://msdn.microsoft.com/en-us/library/windows/desktop/ms695200(v=vs.85).aspx
Yes, when it runs within the sim, it shows the actual data and the format is ok as well.

It seems that the problem is that my app run another copy of the dll in a different process. (under a different process ID)

Unfortunately I have no idea how to "link" the two process...
Topic archived. No new replies allowed.