Solved

Can you call a OOP C++ DLL function ?????

Posted on 2002-04-09
3
264 Views
Last Modified: 2013-11-23
Hi
I have to interface a OOP DLL to get an address.
Here's The Header:

---------
/*
** RCAgent.h - Common interface for Radiocor Agent DLL
*/

#if ! defined (_RCAGENT_H_)
#define _RCAGENT_H_

#if defined (RCAGENT_EXPORT)
#define RCAGENT_EXT_CLASS     __declspec(dllexport)
#else
#define RCAGENT_EXT_CLASS     __declspec(dllimport)
#endif

// To be used to get user's credentials
class RCAGENT_EXT_CLASS CRCDLogon
{
private:
     bool m_bFlgPutCert;      // Per avere il mac address pulito senza nessuna lettera davanti

public:
     CRCDLogon(void)
     {
          Init();
     };
     
     CRCDLogon(bool bOldStyle, bool bInitCert=true)
     {
          Init();
          m_bFlgPutCert = bInitCert;
     }

     virtual ~CRCDLogon(){};

     void Init()
     {
          m_bFlgPutCert = true;
     }

     // this method must be called during client login
     //
     // Return codes:
     // -1 +Arena must terminate
     //  0 username and password to be passed to RAPI
     //  1 +Arena asks username/password to user

     int Logon(HANDLE hWnd, CString& UserName, CString& Password, bool bServer = false);
     int GetVersion(CString& Version);
};

//
class RCAGENT_EXT_CLASS CRCDAgent
{
public:
     CRCDAgent(void);
     virtual ~CRCDAgent();

     int Start(int idSvc = 0, long flType = 0);
     int Stop(void);

     int PutData(const char* pName, const char* pbData);

     int GetItemList (CStringArray& itemList);
     int OnIdle(void);

     int GetVersion(CString& Version);
};

#endif     // _RCAGENT_H_


---------

And here's a C++ sample

--------
// TestCertificato.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "RCAgent.h"


int main(int argc, char* argv[])
{
     CString strCert, strPassword;
     CRCDLogon* pLogonInfo = new CRCDLogon;
     pLogonInfo->Logon(NULL, strCert, strPassword, FALSE);
     printf("\nIl sertificato e': %s", strCert);
     delete pLogonInfo;

     return 0;
}

--------

Logon is the only function I need to call

Can it be done in Delphi 6 Ent.

Thanks in advance
Marco
0
Comment
Question by:mgesiot
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 200 total points
ID: 6930381
Normally not, because like in Delphi a hidden Self/This parameter is handed to the method and these objects are incompatible.
Making a C++ API for a DLL is a common abuse of the DLL concept.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6930388
The header does not contain any obvious calls to a DLL function.
0
 

Author Comment

by:mgesiot
ID: 6937591
Thanks
I ednded up having the DLL programmers to
develop a type library around the DLL,
and it works !!!

Bye
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert a string into a TDateTime 5 50
can't find the executable in Simulator 1 80
creating threads in delphi 1 82
Delphi and Access based Enumeration 9 47
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now