-------
D:\Documents_and_Settings\plp\桌面\test>find /v "" *.*
---------- X.C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "z.h"
int main(int argc, char **argv)
{
data_t *p = malloc(100);
memset(p, 1, 100);
printf("p.a=%x, p.b=%x\n", geta(p), getb(p));
return 0;
}
---------- Y.C
#include "z.h"
struct data_t {
int a;
int b;
};
int geta(data_t *p)
{
return p->a;
}
int getb(data_t *p)
{
return p->b;
}
---------- Z.H
typedef struct data_t data_t;
int geta(data_t *);
int getb(data_t *);
D:\Documents_and_Settings\plp\桌面\test>gcc -c x.c y.c
D:\Documents_and_Settings\plp\桌面\test>gcc -shared -fPIC y.o -o liby.dll
D:\Documents_and_Settings\plp\桌面\test>gcc x.o -ly -L.
D:\Documents_and_Settings\plp\桌面\test>a
p.a=1010101, p.b=1010101
--------