The thirdparty directory is actually a collection of general-purpose third-party libraries that Panda uses, for instance libjpeg and zlib. It’s not actually a place to put third-party contributions to Panda (we don’t have such a directory set aside at this point).
The right way to add C++ code to the Panda source tree depends on the level of integration with Panda required. Since you used the word “module”, I infer that you intend to develop some C++ code that links with libpanda.dll, and also can be loaded into Python.
Of course, you could simply use Visual Studio (or your development environment of choice) and point your include directory at panda3d/include and link with the lib files in panda3d/lib. But this won’t automatically generate wrappers for Python, and it will be difficult to share your code with other users later if you decide to contribute it to our public codebase.
But if you integrate with the Panda build environment, you will get Python wrappers for free, and it will be easy to distribute your code.
To use Panda’s build environment, you will need to create a directory hierarchy populated with Sources.pp files, like direct. In fact, you will probably find it easiest to follow the example presented in the direct tree. In each C++ directory, there is a Sources.pp file that lists the .h and .cxx files that are to be compiled together. There is also a direct/metalibs/direct/Sources.pp that builds the overall libdirect.dll; note the line COMPONENT_LIBS which lists each of the component directories that go into the dll.
You can copy these files into a separate hierarchy of your own, changing names here and there as appropriate. You will also need Package.pp in the root directory of direct.
When you have these files in place, you should be able to run ppremake and make install to build your code.
The keyword PUBLISHED is indeed used to mark methods that are to be made available to Python. It is akin to C++'s public, private, and protected; think of it as an uber-public. With the Sources.pp tree in place properly, the PUBLISHED keyword is all you need to use to expose your methods, although you will also need to add your new dll to the genPyCode command line after you have run make install:
genPyCode mynewlib.dll
David