C: undef_ref added for WIN32

This commit is contained in:
Kolan Sh 2013-02-07 17:55:19 +04:00
parent 2cdee03b9b
commit 1e6235a449
4 changed files with 37 additions and 0 deletions

8
c/undef_ref/win/shared.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
void shared_func ()
{
puts ("shared_func() called successfully! ;-)");
printf ("Calling test_func() from library: ");
test_func ();
}

4
c/undef_ref/win/test.c Normal file
View File

@ -0,0 +1,4 @@
void main ()
{
dll_main ();
}

6
c/undef_ref/win/test.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
gcc -o test_dll.dll test_dll.c -shared
gcc -o shared.dll shared.c -shared -L. -ltest_dll
gcc -o test.exe test.c -L. -ltest_dll -lshared
./test.exe

View File

@ -0,0 +1,19 @@
#include <stdio.h>
#include <windows.h>
test_func ()
{
puts ("test_func() called successfully! ;-)");
}
typedef void (*pfunc)();
void dll_main ()
{
printf ("Calling shared_func() from main: ");
HMODULE lib = LoadLibrary ("shared.dll");
pfunc shared_func = (pfunc)GetProcAddress(lib, "shared_func");
shared_func ();
FreeLibrary (lib);
}