C: undef_ref added for WIN32
This commit is contained in:
parent
2cdee03b9b
commit
1e6235a449
|
@ -0,0 +1,8 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void shared_func ()
|
||||
{
|
||||
puts ("shared_func() called successfully! ;-)");
|
||||
printf ("Calling test_func() from library: ");
|
||||
test_func ();
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
void main ()
|
||||
{
|
||||
dll_main ();
|
||||
}
|
|
@ -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
|
|
@ -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…
Reference in New Issue