File access across DLL

I have a console app that will link with a DLL.
In the app, I open a fiel stream with this:

hFile = fopen( filename, "r" );

and pass the handle to the DLL.

In the DLL, I use fread() to read the file.

In fread(), a calling to _lock_str() throw an exception.

Why? is it something related to locking and unlocking of my stream?
[375 byte] By [ytkok] at [2007-11-20 7:06:23]
# 1 Re: File access across DLL
To do such thing all your modules involved must use the shared version of C runtime.
Igor Vartanov at 2007-11-10 22:59:57 >
# 2 Re: File access across DLL
How to use shared version?
include different header file? add macro definition? or linking with other library?
ytkok at 2007-11-10 23:00:57 >
# 3 Re: File access across DLL
How to use shared version?
include different header file? add macro definition? or linking with other library?Yep, the latter case. In fact, typically you specify the /MD(d) compiler option for this. And in the case compiler uses msvcrt(d).lib.
Igor Vartanov at 2007-11-10 23:02:02 >
# 4 Re: File access across DLL
Sorry! I checked both my original APP and DLL project setting. They both already compiled with /MDd option.
ytkok at 2007-11-10 23:03:07 >
# 5 Re: File access across DLL
And in my turn, I've being built the sample, and it works perfectly. :D
Igor Vartanov at 2007-11-10 23:04:01 >