www.digitalmars.com         C & C++   DMDScript  

c++ - dmc problem

reply rd <rdindir yahoo.com> writes:
Hi All,

First of all, my question is about the C language (and the dmc
compiler).

I have a static library that has functions using fprintf's, fopens
inside. This library is then linked to a DLL (the DLL will be used
from within the lua scripting language).

Anyways, if I try to fopen a file to write, it hangs at that point.
Can we use fopen, printf (standard C functions) from within a DLL?
Are there any commadn line switched that we can use (I am using -mn
when compiling).
Dec 21 2007
parent reply rd <rdindir yahoo.com> writes:
Hi again,

I have tries some other thing too...

I have written a simple DLL with a simple function. This function
just calls printf with a message.

I am using LoadLibrary, GetProcAddress to get to the function in
the main () function. If I leave the printf in the DLL function
it hangs at that point. If I remove that from the function, it
will call that function and the function returns (does not hang
in that DLL function).

Regards,
rd.
Dec 21 2007
parent reply Bertel Brander <bertel post4.tele.dk> writes:
rd skrev:
 Hi again,
 
 I have tries some other thing too...
 
 I have written a simple DLL with a simple function. This function
 just calls printf with a message.
 
 I am using LoadLibrary, GetProcAddress to get to the function in
 the main () function. If I leave the printf in the DLL function
 it hangs at that point. If I remove that from the function, it
 will call that function and the function returns (does not hang
 in that DLL function).
I don't have that problem. To try it I took the source from: http://damb.dk/dllfiles.php (scroll down to the end to download the source and build jobs as a zip file). I then added printf to the functions, and it seems to work.
Dec 21 2007
parent rd <rdindir yahoo.com> writes:
Hi again,

I thank you for your reply.

I was assuming that a DllMain function was suplied, when not given.
Now it is working.

Regards,
rd
Dec 23 2007