|
unix
|
windows
|
|
#include <stdio.h>
#include <stdlib.h>
extern int abc;
void f()
{
abc=100;
printf(
“
function f called abc = %d"n
”
,abc);
}
|
#include <stdio.h>
#include <stdlib.h>
extern int abc;
__declspec(dllexport) void f()
{
abc=100;
printf(
“
function f called abc = %d"n
”
,abc);
}
|
|
unix
|
windows
|
|
int abc = 0;
|
__declspec(dllexport) int abc = 0;
|
|
unix
|
windows
|
|
#include <stdio.h>
#include <stdlib.h>
extern void f();
extern int abc;
main()
{
printf(
“
abc === %d"n
”
,abc);
f();
}
|
#include <stdio.h>
#include <stdlib.h>
__declspec(dllimport) int abc;
__declspec(dllimport) void f;
main()
{
printf(
“
abc === %d"n
”
,abc);
f();
}
|
|
unix
|
Windows
|
|
#ifdef __MY_DLL_H
#define __MY_DLL_H
#include <stdio.h>
#include <stdlib.h>
#if defined(DLLSRC_COMPILED) #define EXPORT
#else
#define EXPORT extern
#endif
EXPORT int abc;
EXPORT void f();
#endif
|
#ifdef __MY_DLL_H
#define __MY_DLL_H
#include <stdio.h>
#include <stdlib.h>
#if defined(TEST_DLL_COMPILED)
#if defined(DLLSRC_COMPILED)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT extern
#endif
#else
#define EXPORT __declspec(dllimport)
#endif
EXPORT int abc ;
EXPORT void f();
#endif
|
|
unix
|
windows
|
|
#include <stdio.h>
#include <stdlib.h>
#include
“
dll_head.h
”
void f()
{
abc=100;
printf(
“
function f called abc = %d"n
”
,abc);
}
|
#include <stdio.h>
#include <stdlib.h>
#include
“
dll_head.h
”
__declspec(dllexport) void f()
{
abc=100;
printf(
“
function f called abc = %d"n
”
,abc);
}
|
|
Unix
|
windows
|
|
#define DLLSRC_COMPILED
#include
“
dll_head.h
”
|
#define DLLSRC_COMPILED
#include
“
dll_head.h
”
|
|
Unix
|
Windows
|
|
#include <stdio.h>
#include <stdlib.h>
#include
“
dll_head.h
”
main()
{
printf(
“
abc === %d"n
”
,abc);
f();
}
|
#include <stdio.h>
#include <stdlib.h>
#include
“
dll_head.h
”
main()
{
printf(
“
abc === %d"n
”
,abc);
f();
}
|
598



被折叠的 条评论
为什么被折叠?



