www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



c++ - dmc problem

↑ ↓ ← 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ → 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