How to make DLLs in cygwin for MSVC and BCB

Patrick Rotsaert patrick.rotsaert@tts-online.be
Wed Jun 22 15:35:00 GMT 2005


Hi all,

I need to build a DLL in cygwin (I use a lot of POSIX functions), that I 
can use in MSVC and Borland CBuilder apps.

There are a lot of docs on the web, but most of them seem to be 
outdated. Anyway, none of the methods I found seam to work.

The DLL will have to be loaded dynamically, i.e. using the win api func. 
LoadLibrary, so I do not need an import library.

What commands do I need to issue to build the dll correctly?

Here's some test code I use:

/* test.c */
#include <windows.h>
__declspec(dllexport) int __stdcall testfunc(char *a, char *b);

BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved)
{
	switch (reason) {
	case DLL_PROCESS_ATTACH:
		break;
	case DLL_THREAD_ATTACH:
		break;
	case DLL_THREAD_DETACH:
		break;
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}

int __stdcall testfunc(char *a, char *b)
{
	strcpy(a, b);
	return 0;
}



--
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