Un programme stocké dans un module dynamique et non dans un exécutable

Commande de compilation...
Commande d'exécution...
Remarque...
Fichiers sources...

upscmp Source=exed

Revenir en haut de la page...

upsstr Module=exed

Revenir en haut de la page...

Cet exemple nécessite d'avoir compilé libcde l'exemple du module chargé dynamiquement implémentant des interfaces.

Revenir en haut de la page...

Source Module "Exemple d'exécutable dynamique" Version 1.0.0 ModuleDynamique;

Composant Dans "c:/up/exemples/exed/exed1.upl";
Source Composant "Exemple d'exécutable dynamique" Version 1.0.0 RattacherA "c:/up/exemples/exed.upl";

Public :
Interface IA Defaut
/*****************/
Public : Public :
Fin Interface

Interface IB HeriteDe IA Defaut
/*****************************/
Public : Public : Fin Interface

Type TA Implemente IA
/*******************/
Public : Fin Type

Type TB Implemente IA
/*******************/
Public : Fin Type

Type TC Implemente IB
/********************/
Public : Fin Type

Public :
Procedure TA.Afficher()
/*********************/
Debut
Ecran.Ecrire("TA : A1=");
Ecran.Ecrire(A1);
Ecran.Ecrire("TA : B1=");
Ecran.Ecrire(B1);
Ecran.Ecrire("TA : C1=");
Ecran.Ecrire(C1);
Ecran.Ecrire("TA : D1=");
Ecran.Ecrire(D1);
Ecran.Ecrire("\n");
Fin Procedure

Fonction TA.F1(P : Booleen) Retourner Booleen
/*****************************************/
Debut
Ecran.Ecrire("TA : F1");
Retourner P;
Fin Fonction

Fonction TA.F2(P : Entier) Retourner Entier
/***************************************/
Debut
Ecran.Ecrire("TA : F2");
Retourner P;
Fin Fonction

Fonction TA.F3(P : Reel) Retourner Reel
/***********************************/
Debut
Ecran.Ecrire("TA : F3");
Retourner P;
Fin Fonction

Fonction TA.F4(P : Caractere) Retourner Caractere
/*********************************************/
Debut
Ecran.Ecrire("TA : F4");
Retourner P;
Fin Fonction

Public :
Procedure TB.Afficher()
/*********************/
Debut
Ecran.Ecrire("TB : A1=");
Ecran.Ecrire(A1);
Ecran.Ecrire("TB : B1=");
Ecran.Ecrire(B1);
Ecran.Ecrire("TB : C1=");
Ecran.Ecrire(C1);
Ecran.Ecrire("TB : D1=");
Ecran.Ecrire(D1);
Ecran.Ecrire("\n");
Fin Procedure

Fonction TB.F1(P : Booleen) Retourner Booleen
/*****************************************/
Debut
Ecran.Ecrire("TB : F1");
Retourner P;
Fin Fonction

Fonction TB.F2(P : Entier) Retourner Entier
/***************************************/
Debut<
Ecran.Ecrire("TB : F2");
Retourner P;
Fin Fonction

Fonction TB.F3(P : Reel) Retourner Reel
/***********************************/
Debut
Ecran.Ecrire("TB : F3");
Retourner P;
Fin Fonction

Fonction TB.F4(P : Caractere) Retourner Caractere
/*********************************************/
Debut
Ecran.Ecrire("TB : F4");
Retourner P;
Fin Fonction

Public :
Procedure TC.Afficher()
/*********************/
Debut
Ecran.Ecrire("TC : A1=");
Ecran.Ecrire(A1);
Ecran.Ecrire("TC : B1=");
Ecran.Ecrire(B1);
Ecran.Ecrire("TC : C1=");
Ecran.Ecrire(C1);
Ecran.Ecrire("TC : D1=");
Ecran.Ecrire(D1);
Ecran.Ecrire("TC : D1=");
Ecran.Ecrire(Caractere(E1, "%jj-%mm-%A"));
Ecran.Ecrire("\n");
Fin Procedure

Fonction TC.F1(P : Booleen) Retourner Booleen
/*****************************************/
Debut
Ecran.Ecrire("TC : F1");
Retourner P;
Fin Fonction

Fonction TC.F2(P : Entier) Retourner Entier
/***************************************/
Debut
Ecran.Ecrire("TC : F2");
Retourner P;
Fin Fonction

Fonction TC.F3(P : Reel) Retourner Reel
/***********************************/
Debut
Ecran.Ecrire("TC : F3");
Retourner P;
Fin Fonction

Fonction TC.F4(P : Caractere) Retourner Caractere
/*********************************************/
Debut
Ecran.Ecrire("TC : F4");
Retourner P;
Fin Fonction

Procedure TC.P1(P : Booleen)
/************************/
Debut
Ecran.Ecrire("TC : P1");
Ecran.Ecrire(P);
Fin Procedure

Procedure TC.P2(P : Entier)
/***********************/
Debut
Ecran.Ecrire("TC : P2");
Ecran.Ecrire(P);
Fin Procedure

Procedure TC.P3(P : Reel)
/*********************/
Debut
Ecran.Ecrire("TC : P3");
Ecran.Ecrire(P);
Fin Procedure

Procedure TC.P4(P : Caractere)
/**************************/
Debut
Ecran.Ecrire("TC : P4");
Ecran.Ecrire(P);
Fin Procedure

Fonction FA() Retourner Nul Ou IA
/*******************************/
Variable Debut
A.A1=Vrai;
A.B1=10;
A.C1=2.71;
A.D1="coucou";
A.Afficher();
Retourner IA(A);
Fin Fonction

Fonction FB() Retourner Nul Ou IA
/*******************************/
Variable Debut
B.A1=Vrai;
B.B1=20;
B.C1=3.14;
B.D1="hello";
B.Afficher();
Retourner IA(B);
Fin Fonction

Fonction FC() Retourner Nul Ou IB
/*******************************/
Variable Debut
C.A1=Vrai;
C.B1=40;
C.C1=1.414;
C.D1="guten tag";
C.E1=Date(10,10,1968);
C.Afficher();
Retourner IB(C);
Fin Fonction

Principal
/*******/
Variable Debut
VA=FA();
VA.Afficher();
Ecran.Ecrire(VA.F1(Vrai));
Ecran.Ecrire(VA.F2(1));
Ecran.Ecrire(VA.F3(2.0));
Ecran.Ecrire(VA.F4("coucou"));
Ecran.Ecrire("\n");

VA=FB();
VA.Afficher();
Ecran.Ecrire(VA.F1(Vrai));
Ecran.Ecrire(VA.F2(1));
Ecran.Ecrire(VA.F3(2.0));
Ecran.Ecrire(VA.F4("coucou"));
Ecran.Ecrire("\n");

VB=FC();
VB.Afficher();
Ecran.Ecrire(VB.F1(Vrai));
Ecran.Ecrire(VB.F2(1));
Ecran.Ecrire(VB.F3(2.0));
Ecran.Ecrire(VB.F4("coucou"));
VB.P1(Faux);
VB.P2(100);
VB.P3(123.45);
VB.P4("...");
Ecran.Ecrire("\n");

M=Module("libc", 1, 0, 0);
Ecran.Ecrire(M.NomModule);
Ecran.Ecrire("\n");
VA=M.NouvelObjet(IA);
VA.Afficher();
Ecran.Ecrire("\n");
VB=M.NouvelObjet(IB);
VB.Afficher();
Ecran.Ecrire("\n");
M=Nul;
Fin Principal

Revenir en haut de la page...