NeoZeed
|
C and C++ in the same prg
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
|
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
|
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
|
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
|