X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Anthony" Newsgroups: comp.os.msdos.djgpp Subject: Re: Problem with Allegro and DzComm (long post) Date: Thu, 1 Apr 2004 17:16:04 +0400 Organization: Radio-MSU NOC, Moscow State University Lines: 97 Message-ID: References: <200404010825 DOT 27593 DOT pavenis AT latnet DOT lv> NNTP-Posting-Host: integra.rmt.ru X-Trace: alpha2.radio-msu.net 1080825387 7776 81.13.30.150 (1 Apr 2004 13:16:27 GMT) X-Complaints-To: usenet AT radio-msu DOT net NNTP-Posting-Date: Thu, 1 Apr 2004 13:16:27 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Andris Pavenis" ???????/???????? ? ???????? ?????????: news:200404010825 DOT 27593 DOT pavenis AT latnet DOT lv... > On Wednesday 31 March 2004 14:17, Anthony wrote: > It's in DZCOMM documentation (it was not read carefully enough): > -------------------- fragment from documentation ---------- > To use dzcomm in your code you will need to put > > > #include > > > in your code. Obviously (I hope) this will only work after you've installed > the library. If you wish to use allegro alongside dzcomm you will need to > include the allegro library. If you do so it is IMPERATIVE that you include > allegro first (this how dzcomm knows where to link to): > > #include > #include This is how I put it. > > > > If you have more than one C file in a project and you wish to access dzcomm > from more than one of those files, you must put the following #define before > all but one of the dzcomm includes: > > #define DZCOMM_SECONDARY_INCLUDE > #include As it is clear from fragments of code above, I use #include only once in my program. Anyway, I've tried to put #define DZCOMM_SECONDARY_INCLUDE before #include "C306th.h" in all my files, just in case. It didn't help. I've read DZComm manual carefully enough and didn't brake it's instructions, I belive. By the way, I've got this from allegro mailing list: > int main() > { > ... > LOCK_VARIABLE(tick); > LOCK_FUNCTION(tick_handler); // error: invalid convertion from 'void > (*)()' to 'void*' ... > } > > If I comment the #include string (and remove everything related > to dzcomm, the code compiles just fine. What can be the case? I guess DzComm redefines the LOCK_FUNCTION macro without putting the appropriate cast for C++. This is a DzComm bug. You can probably fix it by locating the redefinition in dzcomm.h and replacing it by the definition from allegro/include/allegro/platform/aldjgpp.h. .... > `_dzdos_i nstall_param_int' > c:/djgpp/tmp/cctwBPwX.o(.text+0x3e):C306th.cpp: first defined here > c:/djgpp/tmp/ccId1w5b.o(.text+0x5a):thermo.cpp: multiple definition of > `_dzdos_r emove_param_int' > c:/djgpp/tmp/cctwBPwX.o(.text+0x5a):C306th.cpp: first defined here > collect2: ld returned 1 exit status > > What am I doing wrong? I guess it's a problem with 'extern inline' and C++: 'extern inline' is a C idiom that is roughly equivalent to using a macro while it doesn't behave the same in C++. You will probably have to borrow the following trick from Allegro: #ifdef __cplusplus #define AL_INLINE(type, name, args, code) static inline type name args code #else #define AL_INLINE(type, name, args, code) extern inline type name args code #endif #endif The bottom line appears to be that DzComm is not C++ compatible. -- Eric Botcazou I'll try it in a few days. Anthony.