tags:

views:

168

answers:

4

Is there anyway to write dlls in linux? Do I have to install windows to write dlls in linux? Right now one of my courses are pretty retarded and requires me to write a dll for this.

+9  A: 

You should take a look into 'shared libraries' http://www.linux.org/docs/ldp/howto/Program-Library-HOWTO/shared-libraries.html

Chris Batka
+1  A: 

Not really. Building any kind of executable intended for OS "A" while using OS "B" is a process commonly known as cross-compilation. In this partciluar case, you would need a cross-compiler running on Linux, but targetting Windows. I don't know any vendor selling such a product.

MSalters
Don't be silly. GCC/mingw has been a magnificent win32 cross compiler for years now. It works fine, it builds out of the box on every platform supported by gcc, and frankly the toolchain integration is better than Microsoft's products for a lot of purposes. It's not an "easy" solution (I think the previous answer about shared libraries might be a better fit), but it certainly isn't an impossibility.
Andy Ross
+1  A: 

Your best bet is to write one in Windows, as that's the place where they are used and the compilers/tools are designed to support it. There's a lot of funky little compiler directives you need to use to compile a dll, and that's probably best done with a Win32 compiler, ideally VC++.

You could maybe use MinGW in Windows to compile the dll. That would give you the ability to use Linux-esque development tools in the process and make it less painful.

sheepsimulator
A: 

Lots of folks are getting near the right answer but not providing it: gcc can generate win32 PE/COFF files without problem, and of course can always build as a cross compiler on any platform it can target. The binutils port targets windows .exe and .dll files natively, and there's a "dlltool" utility for handling the edge cases where Unix and Windows linkage metaphors are different.

Additionally, the "mingw32" project provides a set of link libraries and header files for building C applications against the win32 API. These likewise install just fine on any Unix.

Here's a site I turned up after a quick google with instructions for building the toolchain.

Andy Ross