Issue of read file in Dll...

Started by
0 comments, last by darkworldgames 21 years, 3 months ago
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...
a leader of game development studio in china
Advertisement
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

Member of the Unban Mindwipe Society (UMWS)

This topic is closed to new replies.

Advertisement