| delorie.com/archives/browse.cgi | search |
| Xref: | news2.mv.net comp.os.msdos.djgpp:2668 |
| From: | malcolm AT manawatu DOT gen DOT nz (Malcolm Taylor) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: MikMod210 |
| Date: | Sat, 13 Apr 1996 07:10:32 GMT |
| Organization: | Grafik Software |
| Lines: | 40 |
| Message-ID: | <4knnj6$k0e@news.manawatu.gen.nz> |
| References: | <199604090947 DOT FAA22372 AT delorie DOT com> |
| Reply-To: | malcolm AT manawatu DOT gen DOT nz |
| NNTP-Posting-Host: | malcolm.manawatu.gen.nz |
| Mime-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Nick Burton <nmr AT doc DOT ntu DOT ac DOT uk> wrote:
>Ok I have this great program (mikmod) which I can make and
>run fine under GNU C Ver 2.x, when its linked to my code.
>But when I try to link it to some of my GNU C++ Ver 2.x
>code make complains at the linking stage that it cant find
>any of the mikmod funcs?
>Can anyone help?
>P.S. both make files are almost identical, its just the main
>program file is changed from .C to .CC
This is because the C++ compiler 'mangles' the underlying function
names to take into account the arguments. Try taking a look with
edebug32 at a simple program and look at what the label for void
main(void) is.
The mikmod headers should (like most C libraries) have their
declarations surrounded by:
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
Which tells the C++ compiler to use unmangled names for the functions
(in otherwords to ignore the arguments like C does).
To fix the problem in your program whenever you include the mikmod
headers surround the #include statement with the ifdef extern business
above.
Hope this helps.
Malcolm
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |