You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Heera Sharma <he...@verizon.com> on 2004/08/20 19:44:44 UTC

Facing problem with Apache Portable Runtime

Hi,
 
I am using APR for thread in my Windows based application. I am using VS
6.0 for compiling the program. I am using APR version 2.0.48. 
 
My application is written in C++ language. I am facing problem when I
try to compile my program. Here is a sample code:
 
 
OOPS.h
 
Public Class OOPS
{
void launchApp();
}
 
OOPS.cpp
 
#include "apr_thread_proc.h"
 
 
void* APR_THREAD_FUNC ThreadProc (void* data)
{
pritf("it worked dude");
return NULL;
}
 
 
OOPS::launchApp()
{
apr_thread_t *thread;
 
if( apr_thread_create( &thread, NULL, ThreadProc, NULL,NULL) !=
APR_SUCCESS) 
{
printf( "Could not create the thread\n");
            exit( -1);
}
 
}
 
int main(int argc, char* argv[])
{
OOPS* pOOPS = new OOPS;
pOOPS->launchApp();
 
}
 
when I compile the above I get following error:
 
'apr_thread_create' : cannot convert parameter 3 from 'void *(void *)'
to 'void *(__stdcall *)(struct apr_thread_t *,void *)'
        None of the functions with this name in scope match the target
type
 
It seems apr is not able to convert "ThreadProc" to 'void *(__stdcall
*)(struct apr_thread_t *,void *)'.
 
If anyone has used APR with C++, please help me out.
 
Thanks
HS