Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - C and C++ in the same prg

Reply to topic
Author Message
NeoZeed
  • Guest
Reply with quote
C and C++ in the same prg
Post Posted: Sat Feb 19, 2000 2:10 pm
Hi there,

I'm working on a port W32 of an Sega emulator, the emu is write in full C. But if i want to use directdraw i must use Cpp (i think) , when i try

Extern "C++" void SetDirectDraw()

in a C source file , i get a link error (unrosable link..) . How can i access Cpp functions in a C file ?
Can anyone help me please

Tia
 
ATani
  • Guest
Reply with quote
Post Posted: Sat Feb 19, 2000 4:56 pm
Quote
> Hi there,

> I'm working on a port W32 of an Sega emulator, the emu is write in full C. But if i want to use directdraw i must use Cpp (i think) , when i try

> Extern "C++" void SetDirectDraw()

> in a C source file , i get a link error (unrosable link..) . How can i access Cpp functions in a C file ?
> Can anyone help me please

> Tia

Make sure you do #include and link in ddraw.lib into your executable.. and you dont have to do the extern stuff... as for accessing DirectDraw from C you have a few options... you can access it via the IDirectDraw_CreateSurface() macros or you can do it like lpDD->lpVtbl->CreateSurface().

Atani
 
Jose Manuel Delgado
  • Guest
Reply with quote
Post Posted: Sat Feb 19, 2000 7:59 pm
I use C and C++ in Calypso and works fine. All you have to do is to put this in your C header files:

#ifdef __cplusplus
extern "c"
{
#endif

[the header file....]

#ifdef __cplusplus
}
#endif

And all should work. Write me if it doesn´t work.


Saludos,

Jose Manuel
 
Neozeed
  • Guest
Reply with quote
Post Posted: Mon Feb 21, 2000 6:13 am
Ok, thanks all, it works now. I use the C syntax of DDraw, i'll use Cpp when i'll do the gui :)

Also, what about Meka 2000 ?


Cheers

NeoZeed
 
Reply to topic



Back to the top of this page

Back to SMS Power!