Langages C, C++, C#... et pilotes Mensura
Les mini-programmes ci-dessous sont le contenu des fichiers main.cpp générés par les logiciels en question.
Code::Blocks, Dev-C++, C++ Builder, Visual C++
Code::Blocks (logiciel libre, Linux et Windows)
#include <iostream>
#include <stdio.h>
#include <stdio.h>
using namespace std;
typedef char *(*stddetailtype) ();
typedef char *(*stdtitretype) ();
typedef double (__stdcall * stdeadtype) (int numvoie);
typedef double (__stdcall * stdeadoubletype) ( double numvoie);
typedef char *(__stdcall *stdneadtype) (int numvoie);
typedef char *(__stdcall *stdeadstrtype) (char * numvoie);
stddetailtype stddetail;
stdtitretype stdtitre;
stdeadtype stdead;
stdneadtype stdnead;
stdeadstrtype stdeadstr;
stdeadoubletype stdeadouble;
int a; double x; char* str = new char[30];
HINSTANCE handle=NULL;
int main()
{
cout << "Hello world!" << endl;
handle=LoadLibrary("bibdyn.dll");
stddetail = (stddetailtype)GetProcAddress(handle,"stddetail");
stdtitre = (stdtitretype)GetProcAddress(handle,"stdtitre");
stdead = (stdeadtype)GetProcAddress(handle,"stdead");
stdnead = (stdneadtype)GetProcAddress(handle,"stdnead");
stdeadstr = (stdeadstrtype) GetProcAddress(handle,"stdeadstr");
stdeadouble = (stdeadoubletype) GetProcAddress(handle,"stdeadouble");
printf(stddetail()) ; printf("\n\r");
printf(stdtitre()); printf("\n\r");
printf(stdnead(0)); printf("\n\r");
x= stdead(0);
sprintf(str, "%.4g", x );
printf(str,'\n'); printf("\n\r");
printf(stdnead(1)); printf("\n\r");
printf(stdeadstr("1")); printf("\n\r");
printf(stdnead(1)); printf("\n\r");
sprintf(str, "%.4g", stdead(2) );
printf(str);
Sleep(2000);
return 0;
}
Dev-C++ (Bloodshed, pour Windows)
#include <cstdlib>
#include <iostream>
using namespace std;
#include <windows.h> //nécessaire pour handle
#include <stdio.h>
typedef char *(*stddetailtype) ();
typedef char *(*stdtitretype) ();
typedef double (__stdcall * stdeadtype) (int numvoie);
typedef double (__stdcall * stdeadoubletype) ( double numvoie);
typedef char *(__stdcall *stdneadtype) (int numvoie);
typedef char *(__stdcall *stdeadstrtype) (char * numvoie);
stddetailtype stddetail;
stdtitretype stdtitre;
stdeadtype stdead;
stdneadtype stdnead;
stdeadstrtype stdeadstr;
stdeadoubletype stdeadouble;
int a; double x; char* str = new char[30];
HINSTANCE handle=NULL;
int main(int argc, char *argv[])
{
printf("Hello World !"); printf("\n\r");
handle=LoadLibrary("bibdyn.dll");
stddetail = (stddetailtype)GetProcAddress(handle,"stddetail");
stdtitre = (stdtitretype)GetProcAddress(handle,"stdtitre");
stdead = (stdeadtype)GetProcAddress(handle,"stdead");
stdnead = (stdneadtype)GetProcAddress(handle,"stdnead");
stdeadstr = (stdeadstrtype) GetProcAddress(handle,"stdeadstr");
stdeadouble = (stdeadoubletype) GetProcAddress(handle,"stdeadouble");
printf(stddetail()) ; printf("\n\r");
printf(stdtitre()); printf("\n\r");
printf(stdnead(0)); printf("\n\r");
x= stdead(0);
sprintf(str, "%.4g", x );
printf(str,'\n'); printf("\n\r");
printf(stdnead(1)); printf("\n\r");
printf(stdeadstr("1")); printf("\n\r");
printf(stdnead(1)); printf("\n\r");
sprintf(str, "%.4g", stdead(2) );
printf(str);
Sleep(2000);
//return 0;
system("PAUSE");
return EXIT_SUCCESS;
}
Borland C++Builder (Borland-Embarcadero, Windows)
#pragma hdrstop
#include <condefs.h>
#include <stdio.h>
#include <iostream> //nécessaire pour handle
//---------------------------------------------------------------------------
#pragma argsused
typedef char *(*stddetailtype) ();
typedef char *(*stdtitretype) ();
typedef double (__stdcall * stdeadtype) (int numvoie);
typedef double (__stdcall * stdeadoubletype) ( double numvoie);
typedef char *(__stdcall *stdneadtype) (int numvoie);
typedef char *(__stdcall *stdeadstrtype) (char * numvoie);
stddetailtype stddetail;
stdtitretype stdtitre;
stdeadtype stdead;
stdneadtype stdnead;
stdeadstrtype stdeadstr;
stdeadoubletype stdeadouble;
int a; double x; char* str = new char[30];
HINSTANCE handle=NULL;
void main (void)
{
sprintf("Hello world");
handle=LoadLibrary("bibdyn.dll");
stddetail = (stddetailtype)GetProcAddress(handle,"stddetail");
stdtitre = (stdtitretype)GetProcAddress(handle,"stdtitre");
stdead = (stdeadtype)GetProcAddress(handle,"stdead");
stdnead = (stdneadtype)GetProcAddress(handle,"stdnead");
stdeadstr = (stdeadstrtype) GetProcAddress(handle,"stdeadstr");
stdeadouble = (stdeadoubletype) GetProcAddress(handle,"stdeadouble");
printf(stddetail()) ; printf("\n\r");
printf(stdtitre()); printf("\n\r");
printf(stdnead(0)); printf("\n\r");
x= stdead(0);
sprintf(str, "%.4g", x );
printf(str,'\n'); printf("\n\r");
printf(stdnead(1)); printf("\n\r");
printf(stdeadstr("1")); printf("\n\r");
printf(stdnead(1)); printf("\n\r");
sprintf(str, "%.4g", stdead(2) );
printf(str);
//sleep(2); //sleep de dos en secondes
Sleep(2000);
}
Microsoft Visual C++ (Microsoft, Windows)
// essai1.cpp : fichier projet principal.
using namespace System;
#include "stdafx.h"
#include <windows.h> //nécessaire pour handle
#include <stdio.h>
using namespace System;
typedef char *(*stddetailtype) ();
typedef char *(*stdtitretype) ();
typedef double (__stdcall * stdeadtype) (int numvoie);
typedef double (__stdcall * stdeadoubletype) ( double numvoie);
typedef char *(__stdcall *stdneadtype) (int numvoie);
typedef char *(__stdcall *stdeadstrtype) (char * numvoie);
stddetailtype stddetail;
stdtitretype stdtitre;
stdeadtype stdead;
stdneadtype stdnead;
stdeadstrtype stdeadstr;
stdeadoubletype stdeadouble;
int a; double x; char* str = new char[30];
HINSTANCE handle=NULL;
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
handle=LoadLibrary(L"bibdyn.dll");//ne pas oublier le L
stddetail = (stddetailtype)GetProcAddress(handle,"stddetail");
stdtitre = (stdtitretype)GetProcAddress(handle,"stdtitre");
stdead = (stdeadtype)GetProcAddress(handle,"stdead");
stdnead = (stdneadtype)GetProcAddress(handle,"stdnead");
stdeadstr = (stdeadstrtype) GetProcAddress(handle,"stdeadstr");
stdeadouble = (stdeadoubletype) GetProcAddress(handle,"stdeadouble");
printf(stddetail()) ; printf("\n\r");
printf(stdtitre()); printf("\n\r");
printf(stdnead(0)); printf("\n\r");
x= stdead(0);
sprintf(str, "%.4g", x );
printf(str,'\n'); printf("\n\r");
printf(stdnead(1)); printf("\n\r");
printf(stdeadstr("1")); printf("\n\r");
printf(stdnead(1)); printf("\n\r");
sprintf(str, "%.4g", stdead(2) );
printf(str);
Sleep(2000);
return 0;
}
Dernière modification le 10/03/2018