--- "Miller, Raul D" <[EMAIL PROTECTED]> wrote:

> Oleg Kobchenko wrote:
> > the proof of concept pcall example is now turned into
> > fully functional Addon. Windows is right now, but can
> > easily be ported to UNIX, since the idea is trivial.
> 
> Documentation suggests that C function 'inc' with definition:
> 
> int inc(int x, int y) {return x+y;}
> 
> Could be invoked as
> 
>   '0 12345 i i i' CONJ 3;4
> 
> if 12345 were the address of inc
> 
> But examples do not match this (I'm guessing they represent
> something more like '1 XXX i i i' CONJ vti;...)
> 
> This is probably not a big issue, since this is just example
> code, but the examples use 'cp4', and I've not dissected the
> demo to see what this means.

You are guessing correctly, but the notation
   '0 12345 i i i' CONJ 3;4
is the proposal to enhance 15!:0

To make a proof of concept, it is now emulated by the pcall.dll.
It has a sightly different approach: it has to have existing 15!:0 notation,
which you use to call a pcall function with corresponding
number of parameters, cp2 (or cc2) in this case and pass the
as parameters function pointer and the rest are the original
parameters. So it looks like
  'pcall cp2 i i  i i' cd 12345 ; 3;4

There are three sets of such wrapper functions like cp2.
  http://www.jsoftware.com/svn/addons/trunk/general/pcall/win/pcall.c

Two of them are just calling convention, where N is number
of parameters N in (0..6):
  cpN  -  call pascall (stdcall)
  ccN  -  call cdecl

The third set is for interface pointer call (using pascal 
convention as in COM)
  ciN  -  call interface

The notation for ciN is
  'pcall ci2 i i  i i' cd 2;789 ; 3;4

where 2 is vt-index and 789 is interface pointer "this"

It will call method "inc", assuming that "this" is 
of such type A*:

class A {
  virtual int __stdcall add(int x, int y);
  virtual int __stdcall dec(int x, int y);
  virtual int __stdcall inc(int x, int y);   // vt-index = 2
};



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to