Bonjour à tous,

J'ai besoin de créer une DLL depuis du code fourni pour l'intégrer dans mes projets Windev. Je n'ai que très peu de connaissances en C, j'ai téléchargé Dev-C++ mais je suis perdu pour créer correctement la DLL.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
The following ‘C’ code represents the way the CRC16 is implemented.
WORD is defined as an unsigned 16bits type.
Make sure to initialize the CRC16 table with InitCRC16(), before you use CalcCRC16().
 
WORD CRC16Table[256] ;
// initialize the CRC16 table
extern void InitCRC16( void ) {
    WORD i, j ;
    WORD crc ;
    for ( i = 0 ; i < 256 ; i += 1 ) {
        for ( crc = i << 8, j = 0 ; j < 8 ; j += 1 )
            crc = ( crc << 1 ) ^ ( ( crc & 0x8000 ) ? 0x1021 : 0 ) ;
        CRC16Table[ i ] = crc ;
    }
}
// calculate the crc of a char array pointed at by p
extern WORD CalcCRC16( unsigned char * p, WORD size ) {
    WORD crc = 0xFFFF ;
    WORD i ;
    for ( i = 0 ; i < size ; i++, p++ ) // for all chars 
        crc = CRC16Table[ ( ( crc >> 8 ) & 255 ) ] ^ ( crc << 8 ) ^ *p ;
    return crc ;
}
Un petit coup de main serait vraiment sympa.
Merci d'avance