Skip to content

Commit e1b581b

Browse files
committed
Export symbols for Windows DLL.
1 parent 630eb59 commit e1b581b

File tree

4 files changed

+44
-32
lines changed

4 files changed

+44
-32
lines changed

precise-timer/PreciseTimerC.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#include "PreciseTimer.hpp"
22
#include "PreciseTimerC.h"
33
extern "C" {
4-
CPT* startTimer( void ) {
4+
EXPORT CPT* startTimer( void ) {
55
return reinterpret_cast<CPT*>(new PreciseTimer);
66
}
77

8-
double getDuration( CPT *pt ) {
8+
EXPORT double getDuration( CPT *pt ) {
99
return reinterpret_cast<PreciseTimer*>(pt)->getElapsedTime( );
1010
}
1111

12-
unsigned int version( void ) {
12+
EXPORT unsigned int version( void ) {
1313
return PreciseTimer::version;
1414
}
1515

16-
void freeTimer( CPT *pt ) {
16+
EXPORT void freeTimer( CPT *pt ) {
1717
delete reinterpret_cast<PreciseTimer*>(pt);
1818
}
1919
}

precise-timer/PreciseTimerC.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
#ifndef PRECISETIMERC_H
22
#define PRECISETIMERC_H
33

4+
#ifdef _WIN32
5+
#define EXPORT __declspec(dllexport)
6+
#else
7+
#define EXPORT
8+
#endif /*_WIN32*/
9+
410
#ifdef __cplusplus
511
extern "C" {
612
#endif
713

814
struct CPT;
915
typedef struct CPT CPT;
1016

11-
CPT* startTimer( void );
12-
double getDuration( CPT *pt );
13-
unsigned int version( void );
14-
void freeTimer( CPT *pt );
17+
EXPORT CPT* startTimer( void );
18+
EXPORT double getDuration( CPT *pt );
19+
EXPORT unsigned int version( void );
20+
EXPORT void freeTimer( CPT *pt );
1521

1622
#ifdef __cplusplus
1723
}

threaded-libcurl/DownloadManagerC.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,55 @@
44

55
// Avoid symbol mangling.
66
extern "C" {
7-
CDlM *newDM( void ) {
7+
EXPORT CDlM *newDM( void ) {
88
return reinterpret_cast<CDlM*>(new DownloadManager);
99
}
1010

11-
uint addDownload( CDlM *mgr, const char *url, const char *outfile, const char *sha1) {
11+
EXPORT uint addDownload( CDlM *mgr, const char *url, const char *outfile, const char *sha1) {
1212
if (NULL == sha1) {
1313
return reinterpret_cast<DownloadManager*>(mgr)->addDownload( std::string(url), std::string(outfile) );
1414
} else {
1515
return reinterpret_cast<DownloadManager*>(mgr)->addDownload( std::string(url), std::string(outfile), std::string(sha1) );
1616
}
1717
}
1818

19-
double progress( CDlM *mgr ) {
19+
EXPORT double progress( CDlM *mgr ) {
2020
return reinterpret_cast<DownloadManager*>(mgr)->getProgress( );
2121
}
2222

23-
int busy( CDlM *mgr ) {
23+
EXPORT int busy( CDlM *mgr ) {
2424
return reinterpret_cast<DownloadManager*>(mgr)->busy( );
2525
}
2626

27-
int checkDownload( CDlM *mgr, uint i ) {
27+
EXPORT int checkDownload( CDlM *mgr, uint i ) {
2828
return reinterpret_cast<DownloadManager*>(mgr)->checkDownload( i );
2929
}
3030

31-
const char* getError( CDlM *mgr, uint i ) {
31+
EXPORT const char* getError( CDlM *mgr, uint i ) {
3232
return reinterpret_cast<DownloadManager*>(mgr)->getError( i );
3333
}
3434

35-
void terminate( CDlM *mgr ) {
35+
EXPORT void terminate( CDlM *mgr ) {
3636
reinterpret_cast<DownloadManager*>(mgr)->terminate( );
3737
}
3838

39-
void clear( CDlM *mgr ) {
39+
EXPORT void clear( CDlM *mgr ) {
4040
reinterpret_cast<DownloadManager*>(mgr)->clear( );
4141
}
4242

43-
int checkFileSHA1( const char *filename, const char *expected ) {
43+
EXPORT int checkFileSHA1( const char *filename, const char *expected ) {
4444
return DownloadManager::checkFileSHA1( std::string( filename ), std::string( expected ) );
4545
}
4646

47-
int checkStringSHA1( const char *string, const char *expected ) {
47+
EXPORT int checkStringSHA1( const char *string, const char *expected ) {
4848
return DownloadManager::checkStringSHA1( std::string( string ), std::string( expected ) );
4949
}
5050

51-
uint version( void ) {
51+
EXPORT uint version( void ) {
5252
return DownloadManager::version;
5353
}
5454

55-
void freeDM( CDlM* mgr ) {
55+
EXPORT void freeDM( CDlM* mgr ) {
5656
delete reinterpret_cast<DownloadManager*>(mgr);
5757
}
5858
}

threaded-libcurl/DownloadManagerC.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#ifndef DOWNLOADMANAGERC_H
22
#define DOWNLOADMANAGERC_H
33

4+
#ifdef _WIN32
5+
#define EXPORT __declspec(dllexport)
6+
#else
7+
#define EXPORT
8+
#endif /*_WIN32*/
9+
410
#ifdef __cplusplus
511
extern "C" {
612
#endif
@@ -9,19 +15,19 @@ struct CDlM;
915
typedef struct CDlM CDlM;
1016
typedef unsigned int uint;
1117

12-
CDlM* newDM ( void );
13-
uint addDownload ( CDlM *mgr, const char *url,
18+
EXPORT CDlM* newDM ( void );
19+
EXPORT uint addDownload ( CDlM *mgr, const char *url,
1420
const char *outfile, const char *sha1 );
15-
double progress ( CDlM *mgr );
16-
int busy ( CDlM *mgr );
17-
int checkDownload ( CDlM *mgr, uint i );
18-
const char* getError ( CDlM *mgr, uint i );
19-
void terminate ( CDlM *mgr );
20-
void clear ( CDlM *mgr );
21-
int checkFileSHA1 ( const char *filename, const char *expected );
22-
int checkStringSHA1( const char *string, const char *expected );
23-
uint version ( void );
24-
void freeDM ( CDlM *mgr );
21+
EXPORT double progress ( CDlM *mgr );
22+
EXPORT int busy ( CDlM *mgr );
23+
EXPORT int checkDownload ( CDlM *mgr, uint i );
24+
EXPORT const char* getError ( CDlM *mgr, uint i );
25+
EXPORT void terminate ( CDlM *mgr );
26+
EXPORT void clear ( CDlM *mgr );
27+
EXPORT int checkFileSHA1 ( const char *filename, const char *expected );
28+
EXPORT int checkStringSHA1( const char *string, const char *expected );
29+
EXPORT uint version ( void );
30+
EXPORT void freeDM ( CDlM *mgr );
2531

2632
#ifdef __cplusplus
2733
}

0 commit comments

Comments
 (0)