PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Porting Problems

If you don't want to red this whole thing, just skip to the bottom :)

I am in the process of porting the game Heroes ([url]heroes.sourceforge.net[/url]). I am using celib (http://www.rainer-keuchel.de/software.html) to fill in the gaps left in the wince api. I have managed to get the source to compile, except for the graphics code.

The game seperates the system code from the game code. Unfortunately, since the game was written in pure ANSI c (as opposed to c++) I am having a bit of trouble stripping the c++ stuff from easyce. The reason I'm posting here is because the problem seems to lie in the GAPI headers; they don't want to compile in a c program. I tried fixing the problems, and it compiles, but then when evc links the program, it gives a bunch of "unresolved external symbol" errors, specifically the following:
Code:

EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXCloseDisplay referenced in function WinMain
EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXCloseInput referenced in function WinMain
EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXIsDisplayDRAMBuffer referenced in function WinMain
EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXGetDisplayProperties referenced in function WinMain
EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXGetDefaultKeys referenced in function WinMain
EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXOpenInput referenced in function WinMain
EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXOpenDisplay referenced in function WinMain
EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXEndDraw referenced in function updatedisplay
EasyCE.obj : error LNK2019: unresolved external symbol __imp_GXBeginDraw referenced in function updatedisplay

Now, I think the error stems from the fact that the functions all have __imp_ prepended to their names. Is there anything I can do to fix this?

To summarize:
I'm porting a game.
It won't compile because:
GAPI doesn't want to work with plain C code
And when the headers are fixed, the compiler tries to call the function with a different name

Anyway, Is there any way I can get the GAPI to work in C? Or is it only usable with C++? If this isn't the case, how can I get it to work?[/code]
Never mind. I got it working.

The PocketQuake source gave me a bit of inspiration: Instead of linking witht the dll, It loaded the dll dynamically with a few API calls.
Actually, I got good news for you! The PocketQuake gx thingy is in plain C. I think Dan rewrote it or something. Perhaps that will quite easily solve a lot of your problems!
I had to add "struct" to a couple definitions in gx.h so the C compiler wouldn't complain.

Dan East
Yeah, that's basically what I did:
Added "struct" to the header, and
used the PocketQuake method of loading the DLL (and functions) using Win API calls.

After I posted here, I went around looking for plain C programs using the GAPI, and PocketQuake was the first one I came across.

BTW, if anyone wants the game, send me an email. I'm not sure about compatibility issues with merging it with the CVS sourve for Heroes on sourceforge, so for now you'll have to get it from me. One thing I'm considering is creating a patch file for the current Linux distribution, and creating my own project page (on sourceforge) with that, but I'm open to suggestions.

It works really well; I added sound support (using MikMod, I needed to remove the threading code, and moved the MikMod_Update calls to the EasyCE update function (Also, If anyone wants my plain c version of EasyCE (All it has is the startup code and the update code, everything else is gone; it's mainly useful for porting DOS mode13h apps), send me an email))