Modules for win32?

These are old archives. They are kept for historic purposes only.
Post Reply
lord2800
Posts: 22
Joined: Sun Mar 07, 2004 3:49 am
Location: root: /dev/null

Modules for win32?

Post by lord2800 » Sun Mar 07, 2004 4:24 am

Unfortunately, due to circumstances slightly beyond my control(lack of a second box and lack of a nic that's supported in linux), I can't use the linux build of Unreal. Are there any modules developed for the Win32 build of Unreal, and if so, where can I find some? I've tried googling and came up with nothing.

codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Post by codemastr » Sun Mar 07, 2004 4:46 am

Well, you can thank Microsoft for that! Microsoft's C compiler lacks the necessary features to allow the Win32 build to support modules.

You can compile a win32 version of Unreal with certain modules compiled in, but you can't simply loadmodule like you can in Linux.
-- codemastr

lord2800
Posts: 22
Joined: Sun Mar 07, 2004 3:49 am
Location: root: /dev/null

Post by lord2800 » Sun Mar 07, 2004 8:05 am

Bah.
/me kicks his windows box.
Anyone up for donating me a new nic? :)

aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight » Tue Mar 09, 2004 11:09 pm

Why can't you use DLLs? LoadLibraryA(), GetProcAddressA()?

codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Post by codemastr » Wed Mar 10, 2004 12:06 am

That works great for having the exe call functions in the dll, but not for the other way around. Under *nix, we specify --export-dynamic and it exports all the ircd's symbols so that the .so can read them. MSVC has no such equivilent. Therefore, it means we have to go through and _manually_ set _every_ variable and function in Unreal to __declspec(dllexport) and then build an import library for the .dll to link with. It can be done, yes, but it is a major pain to do.
-- codemastr

aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight » Wed Mar 10, 2004 12:10 am

don't you use the extern identifier on the vars and functions that you would export?

if so:

Code: Select all

#define extern __declspec(dllexport) extern
Or just make a .DEF file to export them.

codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Post by codemastr » Wed Mar 10, 2004 12:13 am

It still has to be added to each and every file along with an accompanying #undef extern at the end of the file to prevent it from spilling into any system headers. Not to mention, not all of them are extern. Again a difference, in *nix they don't have to be.

And making a .def doesn't help at all, in fact it is at least 5x harder! Now I have to go through each file and make a list of every function and variable Unreal uses. Not only that, each time we add a new function we have to be sure to add an entry to the .def file.
-- codemastr

aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight » Wed Mar 10, 2004 6:32 pm

Can you put __declspec(dllexport) on a namespace?

Something like this?

Code: Select all

#ifdef __cplusplus
__declspec(dllexport) namespace UnrealIRCd {
#endif
// Contents
#ifdef __cplusplus
};
#endif
If that works, all that will happen is the generation of some not-so-nice C++ export names (unless you can extern "C" on or inside a namespace).

codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Post by codemastr » Wed Mar 10, 2004 6:48 pm

Heh, first off, as you said, thats C++, not C.

Second, if we start doing that, then we have symbol mangling. And, I doubt you can export a namespace like that because a namespace itself is not a symbol.
-- codemastr

aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight » Wed Mar 10, 2004 11:46 pm

Yeah, I kinda realized that after I had already posted it. Becuase you can have two namespaces of the same name, and they'll just get merged (which is why the C++ includes (the ones that use namespace std) work).

And doesn't extern "C" stop symbol mangling?

aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight » Sat Mar 27, 2004 2:20 am

Have you ever checked the wIRCd with Dependency Walker? I did, because I have Visual Studio, and I noticed the ircd did have some exports:

Here's a clip from a savefile that had the import/export lists:

Code: Select all

[   ] WIRCD.EXE

     Import  Ordinal       Hint          Function             Entry Point
     ------  ------------  ------------  -------------------  -----------

     Export  Ordinal       Hint          Function             Entry Point
     ------  ------------  ------------  -------------------  -----------
     [C  ]     1 (0x0001)    0 (0x0000)  htm_config_run       0x000019D8
     [C  ]     2 (0x0002)    1 (0x0001)  htm_config_test      0x00001230
     [C  ]     3 (0x0003)    2 (0x0002)  htm_stats            0x00001839
     [C  ]     4 (0x0004)    3 (0x0003)  m_adminchat_Init     0x00001131
     [C  ]     5 (0x0005)    4 (0x0004)  m_adminchat_Load     0x0000108C
     [C  ]     6 (0x0006)    5 (0x0005)  m_adminchat_Unload   0x00001DA7
     [C  ]     7 (0x0007)    6 (0x0006)  m_admins             0x00001276
Of course, this looks like the stuff that would have come from the commands module... but still, there are some exports. Would this mean that a DLL module could invoke commands directly, for example?

Post Reply