0

I am trying to use digital scope Vellman PCSU1000 in one of my projects which I am writing in C++ in Visual Studio 2010.

In order to do this I need to use two DLLs provided by the producer of the device: DSOLink.dll and PCSU1000D.dll. I do not have any other associated files. As far as I understood from the manual those DLLs were writen and compiled in Deplhi. There is a short description of the functions contained in each of DLL and how to use them in different programming languages. For C++ language producer chose Borland C++ Builder and added following code (for using DSOLink.dll, it is analogous for PCSU1000D.dll): DSOLink.h

//---------------------------------------------------------------------------
// DSOLink.h

#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif
#define FUNCTION __declspec(dllimport)

FUNCTION bool __stdcall DataReady(); /*this particular line is added by me based on
 list of the functions listed by dumpbin/exports DSOlink.dll and manual*/
FUNCTION __stdcall ReadCh1(int* ptr);
FUNCTION __stdcall ReadCh2(int* ptr);
#ifdef __cplusplus
}
#endif
//---------------------------------------------------------------------------

According to instruction found in MSDN: http://support.microsoft.com/kb/131313 I have created a .lib file. Thanks to that the Build Solution finishes succesfully but Debugging returns error message "Cannot find the entry point of function _DataReady@0 in DSOLink.dll".

From the article: http://bcbjournal.org/articles/vol4/0012/Using_Visual_C_DLLs_with_CBuilder.htm?PHPSESSID=ab5f6c83b3da921591a490a5accb5bf7 I know that in C++ Builder the keyword *__stdcall* indicates no decoration convetion while in VS means exactly opposite.

I understand that in this situation I am forced to use *__stdcall* in VS (it has to be the same method of managing stack cleaning in DLL and in header used in aplication) and no-decoration method at the same time...I have read that .DEF files may help but I am lost how exactly it should be used. I was trying to create DEF in different ways:

EXPORTS
DataRead=DataRead
.
.
.

EXPORTS
DataRead=_DataRead@0
.
.
.

EXPORTS
_DataRead@0=DataRead
.
.
.

and added one of them at once to my project but none of them solves the problem.

Does anybody have an idea what is the proper way of forcing VS not to use and not to expect decorated names with *__stdcall*? Or maybe reason of my problem is something different and somebody knows it?

Thanks in advance.

maniex
  • 1
  • As `extern "C"` was used, there will be no decoration anyway. If it were me, I wouldn't bother doing more than `LoadLibrary` and `GetProcAddress` to access each exported function. – Roger Rowland May 11 '13 at 14:21
  • thanks for the respons. I will try this too. – maniex May 11 '13 at 14:46

0 Answers0