„SzoftverTechnikakTetelsor” változatai közötti eltérés

Ferrero (vitalap | szerkesztései)
Ferrero (vitalap | szerkesztései)
85. sor: 85. sor:
Linux-on is kb ugyanezt csináljuk, csak másképp.
Linux-on is kb ugyanezt csináljuk, csak másképp.


<pre>%BLACK%
<pre>
%BLUE%#include%ENDCOLOR% %MAROON%&lt;dlfcn.h&gt;%ENDCOLOR%
#include &lt;dlfcn.h&gt;
%BLUE%#include%ENDCOLOR% %MAROON%&lt;stdio.h&gt;%ENDCOLOR%
#include &lt;stdio.h&gt;


%BLUE%typedef int%ENDCOLOR%(*MY_MAX_FUNC)(%BLUE%int%ENDCOLOR%, %BLUE%int%ENDCOLOR%);
typedef int(*MY_MAX_FUNC)(int, int);


int main(){
int main(){
95. sor: 95. sor:
void *handle;
void *handle;


%GREEN%/* Megnyitjuk a konyvtarat. */%ENDCOLOR%
/* Megnyitjuk a konyvtarat. */
handle = dlopen(%MAROON%"./libcomplex.so"%ENDCOLOR%, RTLD_LAZY);
handle = dlopen("./libcomplex.so", RTLD_LAZY);
if(!handle){
if(!handle){
fputs(dlerror(), stderr);
fputs(dlerror(), stderr);
102. sor: 102. sor:
}
}


%GREEN%/* Hozzaferunk a szimbolumhoz. */%ENDCOLOR%
/* Hozzaferunk a szimbolumhoz. */
fvMax = dlsym(handle, %MAROON%"max"%ENDCOLOR%);
fvMax = dlsym(handle, "max");
if(dlerror() != NULL){
if(dlerror() != NULL){
fputs(dlerror(), stderr);
fputs(dlerror(), stderr);
109. sor: 109. sor:
}
}


%BLUE%int%ENDCOLOR% max = (*fvMax)(a, b); %RED%// int max = fvMax(a, b); is ugyanugy mukodik%ENDCOLOR%
int max = (*fvMax)(a, b); // int max = fvMax(a, b); is ugyanugy mukodik


dlclose(handle);
dlclose(handle);
115. sor: 115. sor:
return 0;
return 0;
}
}
%ENDCOLOR%</pre>
</pre>
 


==Bináris komponensek evolúciója 2.==
==Bináris komponensek evolúciója 2.==