How to print out from DLL
Igor Pechtchanski
pechtcha@cs.nyu.edu
Tue Feb 17 16:22:00 GMT 2004
On 2004年2月17日, Mishel wrote:
> Hi,
>> I have a problem with printing to the standart output from DLL.
> 1. I create simple DLL(aaaDll.dll) in the MVS 6.0. This DLL has only one
> function(fnAaaDll()), which prints some strings.
> 2. I create another console application project(aaaTestDll.cpp) in MVS 6.0
> which has only main function. In this function I call function from DLL(befor a
> link the interface library for DLL). In this case I have all printings in the
> console!
> 3. I cleate the interface library for this DLL in the Cygwin:
>> cd ./Release
> echo EXPORTS > aaaDll.def
> echo fnAaaDll >> aaaDll.def
> dlltool --def aaaDll.def --dllname aaaDll.dll --output-lib libAaa.a
> cp libAaa.a /usr/local/lib/libAaa.a
> cd ..
>> and I compile my test programm in the Cygwin(see makefile):
>> AAALDPATH = -L/usr/local/lib
> CC = g++ -pipe -Wno-deprecated
> LN = g++ -static
> LIBS = -lAaa
> LDPATH = $(AAALDPATH)
>> WARN = -Wall -Wbad-function-cast -Wcast-qual \
> -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
> # -Wcast-align -Wredundant-decls -Winline
>> CFLAGS = $(WARN)
>> APPNAME = aaa
> APPOBJS = aaaTestDll.o
>> $(APPNAME) :$(APPOBJS)
> $(LN) -o $@ $(APPOBJS) $(LDPATH) $(LIBS)
> strip $@.exe
> %.o: %.c
> $(CC) -c -g -Wall $(DEF) $(INCL) $< -o $@
>> clean:
> rm -f *.o
> rm -f .depend
> rm -f $(APPNAME).exe
> make -f makefile .depend
>> .depend:
> $(CC) $(DEF) $(INCL) -E -M -MG $(shell ls *.c*) > .depend
>> include .depend
>>> I run result and no printings on the console!
> Question: How I can print from the DLL under Cygwin?
>> Best regards,
> Mishel.
Cygwin programs use their own C runtime, which conflicts with msvcrt.dll
used by Microsoft tools. In short: without really nasty contortions, I
doubt you'd be able to print from both a Cygwin program and a DLL compiled
outside of Cygwin. Either compile all your DLLs under Cygwin as well, or
use the "-mno-cygwin" flag (which invokes the MinGW version of gcc). Note
that in the latter case, you will not get the full POSIX emulation that
Cygwin provides, and your program will be a pure Windows program.
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list