Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

How to debug the pyd code in Visual studio 2013

$
0
0

Hi, 

We have an SDK written in C++ and a testing tool to test that SDK using Python script. 

To communicate between these two we have written an PYD code using Visual studio. 

The thing is I am new to this project and Visual studio. Here I need to debug the pyd code.

I am getting something weird outputs. My code is very simple. I wrote a test application to check the output from the SDK to the PYD code and here is that code.

#include "stdafx.h"
#include "dijsdk.h"
#include <iostream>
#include <Windows.h>
#include <QString>
#include <conio.h>

int _tmain(int argc, _TCHAR* argv[])
{
int result, res;
QString m_guids[16];
DijSDK_CamGuid guids[ARRAYSIZE(m_guids)] = { 0 };
unsigned int numGuids = ARRAYSIZE(guids);
int i;
result = DijSDK_Init();
if (result == 0)
{
res = DijSDK_FindCameras(guids, &numGuids);
if (res == 0)
{
for (i = 0; i < numGuids; i++)
std::cout << guids[i]<<"\n";
}
}
std::cin.get();

}


Here the output of the guids should be :

SynthCam::SynthCam::00000000
uUSB::uUSB::2B9880E2:E884921B:90DE0000:0DEA437A    They are camera names. I am getting the expected output as this from this test app but I have written the same type of code in the PYD which includes lot of other funtions and making the output not to display the camera name uUSB::uUSB::2B9880E2:E884921B:90DE0000:0DEA437A and which it is displaying as empty string in all the cases. The below code shows the code snippet of pyd which calls that function:

static PyObject * SDKTestSuite_FindCameras(PyObject *self, PyObject *args)
{

int result, res;
QString m_guids[16];
DijSDK_CamGuid guids[ARRAYSIZE(m_guids)] = { 0 };
unsigned int numGuids = ARRAYSIZE(guids);
int i;
result = DijSDK_Init();
if (result == 0)
{
res = DijSDK_FindCameras(guids, &numGuids);
if (res == 0)
{
for (i = 0; i < numGuids; i++)
std::cout << guids[i]<<"\n";
}
}

return NULL;

}

So how could I debug this isue. I have to set a breakpoint in the step res = DijSDK_FindCameras(guids, &numGuids); and need to check the guids value.

I tried adding the statement void WINAPI DebugBreak(void); and called my python script.It actually opened the visual studio debuuger and it shows the Source not available. I have placed my pyd file in the python DLL folder.

So Can anyone help me to debug this pyd code. 



Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>