Code crashes when using x86 API DLL

Add useful snippets of code or links to entire SDR projects.
Posts: 107
Joined: Thu Nov 16, 2017 11:06 pm
Location: Gold Coast, QLD, Australia

Code crashes when using x86 API DLL

Postby SteveAndrew » Fri Dec 15, 2017 1:50 am

Hi all

For the past several weeks I've been coding a spectrum analyser for the RSP2, using Visual studio (2010, 2015 and 2017) with C#, compiling for 64 bit operation, using the x64 DLL provided with the API. I have been using the mir_sdr_StreamInit function and providing a callback function as the mir_sdr_Init and mir_sdr_ReadPacket functions have been deprecated. Everything worked well.

For various reasons, I then tried compiling in 32 bit mode, using the x86 DLL. the code crashed, with a "This program has stopped working" message being displayed - no further details being given. After some investigation, I found the problem only showed up when using the streaming function. If the deprecated mir_sdr_Init and mir_sdr_ReadPacket functions are used then all works as expected in both 32 and 64 bit modes.

I suspect that the problem is more likely to be with my code rather than the DLL. I've attached some very simple test code that runs as a console application. I'd be very grateful if somebody who is familiar with C# and .NET programming could have a quick look at it and see if there is a problem with the streaming and callback declarations. The code has been written in unsafe mode, but the problem still remains if the declarations are adjusted and compiled in safe mode.

Many thanks in advance

(1.39 KiB) Downloaded 107 times
Last edited by SteveAndrew on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

Return to “Code Corner”

Who is online

Users browsing this forum: No registered users and 3 guests