accessing memory from address
    Rikki Cattermole via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Aug 30 06:47:36 PDT 2014
    
    
  
On 31/08/2014 1:41 a.m., bojoe wrote:
> I am interfacing with a dll that returns a pointer to an int.
>
> In python, I can use from_address:
>
>   shape=list((c_int*rank).from_address(pi[2].contents.value))
>
> Is there something equivalent in d? Or do I need to manually call
> ReadProcessMemory at that location?
In the c world integral types are a bit more complicated. So for 
reference take a look at the table on [0].
As long as you have a pointer to a piece of data such as int* or void* 
you should be free to dereference it to get the value.
Such as:
extern(C) int* myCFunc();
void main() {
   int value = *myCFunc();
}
[0] http://dlang.org/interfaceToC.html
    
    
More information about the Digitalmars-d-learn
mailing list