Archived

This topic is now archived and is closed to further replies.

darkworldgames

Issue of read file in Dll...

Recommended Posts

I have created 2 dlls : Dll_1 and Dll_2 Open a file with fopen(...) function in Dll_1 and return file stream structure pointer(FILE*) But the "unhandled exception..." happened when i try to read datas with fread(...) function in Dll_2 ,the file stream pointer is get from Dll_1,and it''s valid before fread() function when i Trace it. but if use Dll_1 in a client execute file ,nothing error getted. Does dlls read file stream data from opened in another Dll is invalid useage? need someone dll experts help me... thanks!!! & Very thanks for reading my ugly englis...

Share this post


Link to post
Share on other sites
quote:
...It''s valid before fread() function when i Trace it

The pointer points to something, yes, but what it points to means nothing in the context of the other DLL.
AFAIK you can''t transfer FILE*s out of a DLL and expect them to work. I''m not sure (untested), but Win32 style files (from CreateFile(), OpenFile(), ReadFile(), ...) might work ok.

HTH

Share this post


Link to post
Share on other sites