Pregunta

Question. When using external libraries, is there the same pointer! in Rebol2 as there is in Red/System?

If the c declaration were:

void f (int* i);

How would I define the routine!?

f: make routine! [
    "Does Something"
    int [pointer! [integer!]]
    return: [char!]
] lib "f"

I see http://rebol.com/docs/library.html#section-25

"External library functions that are passed pointers, generally expect the pointers to be char or void datatypes. Currently, REBOL routines do not support the void datatype. In most cases, you can safely pass char instead of void. For return values, use long instead of void."

However, just a little confused. What is the correct way to define the routine for f?

¿Fue útil?

Solución

as the link states

f: make routine! [
  "Does Something"
  pInt [char*]
  return: [long]
] lib "f"  

worked for me a few years ago

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top