Calling the discover routine using C++

Post questions and issues with Concept2 PM3 SDK
Post Reply
nickdeacon
Paddler
Posts: 2
Joined: May 30th, 2006, 6:33 am
Location: UK

Calling the discover routine using C++

Post by nickdeacon » June 3rd, 2006, 5:47 am

I am attempting to call the routine tkcmdsetDDI_discover_pm3s from within a C++ MFC dialog based application using Visual Studio 2005. It should be very similar to the sample app in the sdk.

I can call init functions, and I can get the dll version numbers, but as soon as I try to call the discover_pm3s I get an exception error.

The only difference between this routine and the ones I can call is that it takes parameters, but I am passing the parameters exaclty as the sample code.

Has anyone else had this problem and can point me to where the problem lies?

haboustak
500m Poster
Posts: 77
Joined: March 17th, 2006, 3:02 pm
Location: Cincinnati

Post by haboustak » June 5th, 2006, 9:36 am

Are you using Managed C++? What's the exception?

VB throws an exception on every function with parameters, due to the C calling convention used in the DLL (cdecl vs stdcall). I wouldn't expect that to be a problem with C++, but you might want to look into it.

Are you sending in proper parameters?

Code: Select all

UINT16_T device_count;
tkcmdsetDDI_discover_pm3s(TKCMDSET_PM3_PRODUCT_NAME2, 0, &device_count);
Mike

nickdeacon
Paddler
Posts: 2
Joined: May 30th, 2006, 6:33 am
Location: UK

Post by nickdeacon » June 5th, 2006, 4:11 pm

Thanks Mike

The exception is actually 'invalid handle', looking at the call stack, it seems to have got lost in the kernel. I think that the calling convention must be wrong although I have specified cdecl and the parameters are correct.

I tried calling the dll through a managed c# project and that works fine.

I need to investigate this further...

Nick

User avatar
Bas
Paddler
Posts: 1
Joined: November 16th, 2007, 4:15 am

Post by Bas » November 23rd, 2007, 7:13 am

I'm having the same problem. At first I thought it was the compilers fault(using Visual Studio 2008 instead of 2005). But now that I see you have the same problem I'm confused.

Im not using MFC but just a regular console application. Initialization of the dll works the same as in the sample application. When I call tkcmdsetDDI_discover_pm3s I get an exception saying 'invalid handle'

Did you solve the problem?

Bas

sensor
Paddler
Posts: 5
Joined: December 1st, 2007, 3:20 am

Pb with PM4 BUG Dll

Post by sensor » December 11th, 2007, 5:30 am

I have the same pb . I have a PM4 et the function crash when i discover PM3 . but only in debug ! in release , it's OK. For resolve my probleme i discover only PM4 and it's ok in debug and release.

Excuse for my bad english.

Sensor

Post Reply