call Harbour from c++

Post Reply
User avatar
don lowenstein
Posts: 196
Joined: Mon Oct 17, 2005 9:09 pm
Contact:

call Harbour from c++

Post by don lowenstein »

Is it possible to call a Harbour function from c++ source code?
I have syntax for c-style coding. I'm trying to code an event function to monitor a secure SSL socket.

i wish for my harbour program to use the callback function below, and it will happen with the precursor call here:
nResult = HttpRegisterEvent(hClient, 0xFFFF, MyEventHandler, 0);


Here is the actual event handler where I need to execute Harbour code, namely a function called SSL_EVENTS which is compiled with Harbour 3.2 and FWH 1302 and BCC.

VOID CALLBACK MyEventHandler(HCLIENT hClient, UINT nEventId, DWORD dwError, DWORD_PTR dwParam)
{
switch (nEventId)
{
case HTTP_EVENT_CONNECT:
// Connection has been established

CAN I CALL A HARBOUR EVENT HANDLER FROM HERE?
IF SO, HOW DO i CONSTRUCT THE .C SOURCE CODE TO COMPILE PROPERLY?
ALSO, HOW TO CODE THE CALL TO THE BELOW FUNCTION FROM WITHIN HARBOUR?

break;

// Additional case statements ...
}
}


Any ideas?
Don Lowenstein
www.laapc.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: call Harbour from c++

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
don lowenstein
Posts: 196
Joined: Mon Oct 17, 2005 9:09 pm
Contact:

Re: call Harbour from c++

Post by don lowenstein »

Hi Antonio.

I have completed my HTTPS-SSL secure connection posting data to/from a server on a secured connection using "odd" encoding requrements.

thank you so much for your help.

I used a library from Socket Tools and it worked like a charm.

if you wish I can share the basic flow. i think that your magical c++ and Harbour skills could incorporate an SSL class derived from tSocket. that's what I essentially did. only, I replaced your connect, senddata, recvdata methods with new ones. also, I used a synchronous connection and therefore did not need event notification and no requirement for an owner window to receive messages.

thanks again and thank you for 10 years of providing excellent products and support to me.

don
Don Lowenstein
www.laapc.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: call Harbour from c++

Post by Antonio Linares »

Don,
if you wish I can share the basic flow
yes, please. thanks :-)
i think that your magical c++ and Harbour skills could incorporate an SSL class derived from tSocket. that's what I essentially did. only, I replaced your connect, senddata, recvdata methods with new ones. also, I used a synchronous connection and therefore did not need event notification and no requirement for an owner window to receive messages.
I will review your code and will do my best to build such Class, thanks. Surely many users will benefit from it :-)
thanks again and thank you for 10 years of providing excellent products and support to me.
My pleasure. I feel honored having such great friends all around the world. A true blessing :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply