我正在尝试在 Ubuntu 中使用 Code::Blocks 创建动态库 T 已经创建了下一个文件:
1. main.c
#include "main.h"
#include <stdio.h>
#include <stdlib.h>
void _scan_file (char s[100], Plong a)
{
FILE *f;
f = fopen(s, "r");
int i = 3;
char q[MaxSize + 4];
while (fread(&q[i++], sizeof(char), 1, f)){}
--i;
int k = 0;
if (q[3] == '-' || q[3] == '+')
{
a -> sign = q[3];
q[3] = '0';
}
else
a -> sign = '+';
i--;
q[0] = q[1] = q[2] = '0';
int j;
for (j = i; j >= 3; j -= 4)
{
int p;
for (p = 3; p >= 0; p--)
if (q[j-p] <= '9' && q[j-p] >= '0')
a -> num[k] = a -> num[k] * 10 + q[j - p] - 48;
++k;
}
if (a -> num[--k] == 0)
{
a -> len = k;
}
else
a -> len = k + 1;
fclose(f);
}
主文件
#ifndef MAIN_H_INCLUDED #define MAIN_H_INCLUDED #include <stdio.h> #include <stdlib.h> const int MaxSize = 1000; const int _Base = 10000; const int Max_Pos = 4; typedef int l_int; struct long_num { int len; char sign; l_int num[]; }; typedef struct long_num Llong; typedef Llong * Plong; extern void _scan_file (char *s, Plong a); #endif
但是当我运行这个 Code::Blocks 并没有创建任何 *.so 文件所以我不知道该怎么做......有人可以帮助我吗?