Mer 0 Posted September 11, 2018 Share Posted September 11, 2018 https://www.prepar3d.com/SDKv4/sdk/pdk_api/service_providers/group__weatherservice.htm I need to access the functions made available by the above service through a C# console application I tried using C++ code and making the dll aviailable in C#. My codes: C++ extern "C" __declspec(dllexport) void __stdcall getPressure() { printf("Reading global pressure : "); CComPtr<IWeatherSystemV430> weatherSystem = PdkServices::GetWeatherSystem(); printf("weather system "); float pressure = weatherSystem->GetGlobalBaroPressure(); printf("%f", pressure); } C# [DllImport("CameraPDK.dll", CallingConvention = CallingConvention.StdCall)] public static extern float getPressure(); static void Main(string[] args) { Console.WriteLine("The global pressure is {0}",getPressure()); } But i get a system.accessviolation when the execution reaches GetGlobalPressure() function Could anyone guide me on the right way to do it? Thank you Link to comment Share on other sites More sharing options...
Deputy Sheriffs mopperle 4162 Posted September 11, 2018 Deputy Sheriffs Share Posted September 11, 2018 I guess it would be better to ask this question in the Prepar3D developer forum:https://www.prepar3d.com/forum/viewforum.php?f=54658&sid=547a40256a09085215e808d02bb3f892 Link to comment Share on other sites More sharing options...
Deputy Sheriffs mopperle 4162 Posted September 11, 2018 Deputy Sheriffs Share Posted September 11, 2018 Because we believe this topic has been answered we have closed it. If you have any more questions feel free to open a new topic. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.