tworzenie biblioteki dll w zależności od użycia funkcji

0

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?

0

Nie rozumiem; chcesz, żeby biblioteka DLL linkowała w sobie funkcje, które ani nie są wewnętrznie przez nią wykorzystywane, ani nie są eksportowane na zewnątrz? Jaki jest sens trzymania w binarce martwego kodu?

0

@maszynaz rozumiem że to jest twoje uber-zabezpiecznie przed piraceniem? :D

1 użytkowników online, w tym zalogowanych: 0, gości: 1