August 2003
Intermediate to advanced
496 pages
11h 59m
English
You can now test your Cygwin installation by compiling a simple DLL with the gcc utility and calling it from a C# .NET program. Here is an example of how to do this.
Create the following C source code file named MyDll.c. This will be compiled with the gcc utility to create a Windows DLL.
//MyDll.c
#include <windows.h>
int WINAPI DllMain(
HANDLE hInst,
ULONG reason,
LPVOID lpReserved)
{
return 1;
}
__declspec(dllexport) char* SomeDllFunction()
{
return "SomeDllFunction called!";
}
Here is the command line for compiling and generating MyDll.dll. This can be executed at an ordinary Windows command prompt or at the Cygwin Bash Shell prompt.
gcc -shared MyDll.c -o MyDll.dll -e DllMain@12
Here is the C# client program ...
Read now
Unlock full access