Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: localhost.localdomain: ronald owned process doing -bs Date: Wed, 14 May 2003 12:29:21 +0200 (CEST) From: Ronald Landheer-Cieslak X-X-Sender: ronald AT localhost DOT localdomain To: RomikB cc: cygwin AT cygwin DOT com Subject: Re: DLL creating problem In-Reply-To: <10212936061.20030513223900@mail.ru> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII ELF is a Linux format - that won't work in any case. (remember: Cygwin is a DLL that allows Windows programs to use POSIX functions, but they're still Windows programs) You'll also have to use the -mno-cygwin switch to disable the use of the Cygwin DLL as a runtime library, and make sure your calling conventions in asm match those in the CRT you use (if using -mno-cygwin, the CRT would be MSVCRT). Now, without having tested this, that should boil down to: $ nasm -f win32 -o file_asm.o file_asm.asm $ gcc -c file_c.c -o file_c.o $ gcc -mno-cygwin -shared -o file_dll.dll -Wl,--out-implib=libfile_dll.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive file_asm.o file_c.o -Wl,--no-whole-archive -Wl,--output-def=libfile_dll.dll.def I've tried this with the code you provided but the asm doesn't compile - fixing that is up to you. I tried some other assembler code and got a valid Win32 DLL that didn't depend on Cygwin HTH rlc On Tue, 13 May 2003, RomikB wrote: > Hello All, > > I have a problem when trying to create a DLL. > > For Ex: > > i have two source files: file_asm.asm , file_c.c > > ------file_asm.asm------- > global _function_asm > extern _printf > section .text > _function_asm: > push dword str > call _printf > add esp,0x04 > mov ecx,0x1000 > mov edi,bss_data > rep stosd > ret > section .data > str db "String2print",0 > section .bss > bss_data resd 0x1000 > ------file_c.c------ > void function_c(void){ > } > -------------------- > > I need to create a DLL(no-cygwin) > > compile: > nasm -f format -o file_asm.o {format = elf | win32 | coff } > gcc -c file_c.c -o file_c.o > > link: > i use: > gcc -shared ... > ld -shared ... > gcc -mdll ... > ld -dll ... > dllwrap ... > but i can't create a true dll > > some switches creates not a dll. > > other creates a "wrong" dll. It has a section size problem and not > working under the windowsXP or 2k. ( format == elf ) > or create a "incorrect" dll. It have a > mov edi,bss_data+something instead of mov edi,bss_data > (format == win32 or coff) > > please, give me a hint. How can i create a DLL. > > -- 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/