Mam prostą bibliotekę.
Poniższy kod tworzy dll-kę o rozmiarze 1.8MB.
#include "stdafx.h"
#include "biblioteka.h"
// This is an example of an exported variable
BIBLIOTEKA_API int nbiblioteka=0;
// This is an example of an exported function.
BIBLIOTEKA_API int fnbiblioteka(void)
{
return 42;
}
// This is the constructor of a class that has been exported.
// see biblioteka.h for the class definition
Cbiblioteka::Cbiblioteka()
{
pj_status_t status;
status = pjsua_create();
return;
}
Poniższy kod tworzy prawie pustą dll-kę o rozmiarze 29KB zawierającą tylko 4 funkcje.
#include "stdafx.h"
#include "biblioteka.h"
// This is an example of an exported variable
BIBLIOTEKA_API int nbiblioteka=0;
// This is an example of an exported function.
BIBLIOTEKA_API int fnbiblioteka(void)
{
return 42;
}
// This is the constructor of a class that has been exported.
// see biblioteka.h for the class definition
Cbiblioteka::Cbiblioteka()
{
return;
}
Czyli wygląda na to, że jak się nie użyje jakiejś funkcji to kompilator nie wkopiowuje jej do pliku wynikowego.
Czy da się to obejść i utworzyć bibliotekę bez jawnego wywoływania funkcji, które mają być eksportowane?