I am loading (in my pascal project) dynamically a library that was written in C and has some methods that receive a file pointer as parameter.... let say:
/* fopen example */
#include <stdio.h>
FILE * pFile;
pFile = fopen ("myfile.txt","r");
DoSomething(pFile);
in my pascal project i have an implementation for the DoSomething method that receive as parameter a Pointer.
In the C code the pFile is (typedef struct _IO_FILE)
I need to know the readfile pascal code that give me a pointer as result to pass to my method.
for instance, if i try something like:
Instream: TFilestream;
Instream := TFilestream.Create(fpath, fmOpenRead);
DoSomething(Instream);
this code compile but does not work
An unhandled exception occurred at $00007F27FFDAC888:
EAccessViolation: Access violation
Can any of you help me with this?
thanks!! Sebastian