hi!
i had a look on the sample prx from pspsdk,
i saw that you can provide functions.
is it also possible to offer classes etc?
if so, how?
i guess varibles are passed by:
psp_export_var*
whats the diff between:
_nid and _hash
thanks in advance
lumo
PRX & Functions, Objects, variables
Well for a start you might want to read http://forums.ps2dev.org/viewtopic.php?t=4269 which describes how to build PRXes in PSPSDK along with descriptions of the various bits in psp-build-exports like the different between _NID and _NAME.
As for exporting C++ objects theoretically you can do it if you want to put in the time. C++ functions are exported as mangled names to the linker, the linker itself doesn't really know they are C++ functions, all it sees is a weird name which it ties with other weird names. Take for example a simple class.
If you compile that then run nm on the resulting binary you find 5 symbols.
The first one is the mangled form of Test::Hello(), the next two are constructor definitions and the last two are the destructor definitions.
If you export from your application these function names they should in theory line up and you will be able to import them in your application. There are of course caveats, you probably can't externally access static variables for a start due to the way I think the PSP's variable export works, you probably cannot use exceptions, and it is pretty nasty to maintain if you change anything in your class but it should be doable.
Of course it is questionable if it is even worth it, the library import interface is abit restrictive, for example catching unresolved symbols will be abit of a nightmare, and I can't really see the biggest reason why you would necessarily want importable classes anyway, perhaps it is just me.
Have fun anyway :P
As for exporting C++ objects theoretically you can do it if you want to put in the time. C++ functions are exported as mangled names to the linker, the linker itself doesn't really know they are C++ functions, all it sees is a weird name which it ties with other weird names. Take for example a simple class.
Code: Select all
class Test
{
public:
Test();
~Test();
void Hello(const char *str);
};
Code: Select all
00000018 T _ZN4Test5HelloEPKc
00000006 T _ZN4TestC1Ev
00000000 T _ZN4TestC2Ev
00000012 T _ZN4TestD1Ev
0000000c T _ZN4TestD2Ev
If you export from your application these function names they should in theory line up and you will be able to import them in your application. There are of course caveats, you probably can't externally access static variables for a start due to the way I think the PSP's variable export works, you probably cannot use exceptions, and it is pretty nasty to maintain if you change anything in your class but it should be doable.
Of course it is questionable if it is even worth it, the library import interface is abit restrictive, for example catching unresolved symbols will be abit of a nightmare, and I can't really see the biggest reason why you would necessarily want importable classes anyway, perhaps it is just me.
Have fun anyway :P