Exemplo n.º 1
0
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
{
  DCCallback* pcb;
  int err = dcAllocWX(sizeof(DCCallback), (void**) &pcb);
  if (err != 0) return 0;

  dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
  dcbInitCallback(pcb, signature, handler, userdata);

  return pcb;
}
Exemplo n.º 2
0
int main()
{
  int err;
  void* ptr;
  dcTest_initPlatform();

  err = dcAllocWX(23, &ptr);
  if(!err) dcFreeWX(ptr, 23);
  printf("result: test_alloc_wx: %d\n", (!err) ? 1 : 0 );

  dcTest_deInitPlatform();

  return err;
}
Exemplo n.º 3
0
void test_wx()
{
  DCThunk* p;
  printfun* fp;
  int err = dcAllocWX(sizeof(DCThunk), (void**)&p);
  if(err || !p) {
    printf("0\n");
    return;
  }
  dcbInitThunk(p, &my_entry);
  fp = (printfun*)p;
  fp("wx");
  dcFreeWX((void*)p, sizeof(DCThunk));
}
Exemplo n.º 4
0
DCAdapterCallback* dcRawCallAdapterSkipTwoArgs(void (*handler)(), int callMode)
{
#ifndef DIRECT_SKIP_TWO_ARGS
	return NULL;
#else
	int err;
	DCAdapterCallback* pcb;
	if (callMode != DC_CALL_C_DEFAULT)
		return NULL;
	
	err = dcAllocWX(sizeof(DCAdapterCallback), (void**) &pcb);
	if (err != 0) 
		return 0;
	
	dcbInitThunk(&pcb->thunk, DIRECT_SKIP_TWO_ARGS);
	pcb->handler = handler;
	return pcb;
#endif
}
Exemplo n.º 5
0
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
{
  int err;
  DCCallback* pcb;
  err = dcAllocWX(sizeof(DCCallback), (void**)&pcb);
  if(err)
    return NULL;

  dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
  dcbInitCallback(pcb, signature, handler, userdata);

  err = dcInitExecWX(pcb, sizeof(DCCallback));
  if(err) {
    dcFreeWX(pcb, sizeof(DCCallback));
    return NULL;
  }

  return pcb;
}
Exemplo n.º 6
0
void test_wx()
{
  DCThunk* p;
  printfun* fp;
  int err = dcAllocWX(sizeof(DCThunk), (void**)&p);
  if(err || !p) {
    printf("0\n");
    return;
  }
  dcbInitThunk(p, &my_entry);
  err = dcInitExecWX((void*)p, sizeof(DCThunk));
  if(err) {
    dcFreeWX((void*)p, sizeof(DCThunk));
    printf("0\n");
    return;
  }
  fp = (printfun*)p;
  if(setjmp(jbuf) != 0)
    printf("sigsegv\n");
  else
    fp("wx");
  dcFreeWX((void*)p, sizeof(DCThunk));
}