C: undef_ref added for WIN32
This commit is contained in:
parent
2cdee03b9b
commit
1e6235a449
8
c/undef_ref/win/shared.c
Normal file
8
c/undef_ref/win/shared.c
Normal 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
4
c/undef_ref/win/test.c
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
void main ()
|
||||||
|
{
|
||||||
|
dll_main ();
|
||||||
|
}
|
6
c/undef_ref/win/test.sh
Executable file
6
c/undef_ref/win/test.sh
Executable 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
|
19
c/undef_ref/win/test_dll.c
Normal file
19
c/undef_ref/win/test_dll.c
Normal 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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user