summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorJan Jezabek <jezabek@poczta.onet.pl>2008-07-04 16:15:12 +0000
committerJan Jezabek <jezabek@poczta.onet.pl>2008-07-04 16:15:12 +0000
commit5b03b604b8e9cacd3a970e52654c6bac91af8c76 (patch)
treed60a98c7062a6987c21681ed8a8ef6ee375c2a07 /Lib
parentb9a0db83a600c416a8d9414ec2c63daab8c7b7b3 (diff)
downloadswig-5b03b604b8e9cacd3a970e52654c6bac91af8c76.tar.gz
Generate a resource definition (.rc) file. For now I assume that the type library is included in the final DLL. I will make a bit more flexible later.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-jezabek@10651 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib')
-rw-r--r--Lib/com/com.swg16
1 files changed, 13 insertions, 3 deletions
diff --git a/Lib/com/com.swg b/Lib/com/com.swg
index 9db269af9..f559c96bc 100644
--- a/Lib/com/com.swg
+++ b/Lib/com/com.swg
@@ -328,7 +328,7 @@ STDAPI DllRegisterServer(void) {
module_name = (char *) malloc(allocated);
typelib_name = (char *) malloc(allocated);
#endif
- used = GetModuleFileName(SWIGModule /*GetModuleHandle("$module.dll")*/, module_name, allocated);
+ used = GetModuleFileName(SWIGModule, module_name, allocated);
if (used == allocated) {
#ifdef __cplusplus
@@ -343,10 +343,15 @@ STDAPI DllRegisterServer(void) {
} while (used == allocated);
strcpy(typelib_name, module_name);
+
+/* This needs to be made more flexible */
+/* For now we assume that the TLB is a resource in the DLL */
+#if 0
/* Change .dll to .tlb */
typelib_name[used - 3] = 't';
typelib_name[used - 2] = 'l';
typelib_name[used - 1] = 'b';
+#endif
for (i = 0; SWIGClassDescription[i].newInstance != NULL; ++i) {
HKEY hkey_clsid = NULL,
@@ -497,8 +502,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
if (fdwReason == DLL_PROCESS_ATTACH) {
SWIGModule = hinstDLL;
- /* FIXME: temporary, just for testing. I'll come up with something sensible ;) */
- SWIG_typelib_path = L"c:\\swig\\simple.tlb";
+#ifdef __cplusplus
+ SWIG_typelib_path = new OLECHAR[MAX_PATH + 1];
+#else
+ SWIG_typelib_path = (OLECHAR *) malloc((MAX_PATH + 1) * sizeof(OLECHAR));
+#endif
+
+ GetModuleFileNameW(SWIGModule, SWIG_typelib_path, MAX_PATH + 1);
LoadTypeLib(SWIG_typelib_path, &SWIG_typelib);
}