summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorJan Jezabek <jezabek@poczta.onet.pl>2008-07-02 22:16:55 +0000
committerJan Jezabek <jezabek@poczta.onet.pl>2008-07-02 22:16:55 +0000
commit44cb482802509c19130864fcecaa93d09cd6f8fd (patch)
treeaa64849cd9ace4e24445d08a0b22c1c79d6c575d /Lib
parent48ae20d388018683188677ce651cf4541aa41eb6 (diff)
downloadswig-44cb482802509c19130864fcecaa93d09cd6f8fd.tar.gz
Preliminary support for IDispach (for some reason this does not work for proxies yet). Skeleton of DllMain.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-jezabek@10631 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib')
-rw-r--r--Lib/com/com.swg51
1 files changed, 50 insertions, 1 deletions
diff --git a/Lib/com/com.swg b/Lib/com/com.swg
index a0c7a0ffd..e40a15268 100644
--- a/Lib/com/com.swg
+++ b/Lib/com/com.swg
@@ -69,6 +69,7 @@ typedef struct {
void *cPtr; /* pointer to the wrapped object */
int cMemOwn; /* memory owned by the proxy? */
long refCount; /* reference count */
+ ITypeInfo *typeInfo; /* ITypeInfo object for IDispatch */
} SWIGWrappedObject;
GUID IID_ISWIGWrappedObject = { 0x73738294, 0x8833, 0x1182, { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78 }};
@@ -105,6 +106,39 @@ void * SWIGSTDCALL SWIGGetCPtr(void *iunk) {
return obj->cPtr;
}
+HRESULT SWIGGetTypeInfoCount(SWIGWrappedObject *obj, unsigned int * pctinfo) {
+ *pctinfo = 1;
+
+ return S_OK;
+}
+
+HRESULT SWIGGetTypeInfo(SWIGWrappedObject *obj, unsigned int iTInfo, LCID lcid, ITypeInfo ** ppTInfo) {
+ *ppTInfo = obj->typeInfo;
+
+ return S_OK;
+}
+
+HRESULT SWIGGetIDsOfNames(SWIGWrappedObject *obj, REFIID riid, OLECHAR FAR* FAR* rgszNames,
+ unsigned int cNames, LCID lcid, DISPID FAR* rgDispId) {
+ HRESULT hres = DispGetIDsOfNames(obj->typeInfo, rgszNames, cNames, rgDispId);
+
+ return hres;
+}
+
+HRESULT SWIGInvoke(SWIGWrappedObject *obj, DISPID dispIdMember, REFIID riid, LCID lcid,
+ WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult,
+ EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr) {
+ HRESULT hres = DispInvoke(
+ (void *) obj, obj->typeInfo,
+ dispIdMember, wFlags, pDispParams,
+ pVarResult, pExcepInfo, puArgErr);
+
+ return hres;
+}
+
+static OLECHAR *SWIG_typelib_path;
+static ITypeLib *SWIG_typelib;
+
typedef struct {
SWIG_funcptr *vtable;
SWIG_funcptr newInstance;
@@ -237,6 +271,8 @@ void * SWIGSTDCALL SWIG_wrap_opaque(void *arg) {
%insert("factory") %{
+static HMODULE SWIGModule;
+
STDAPI DllGetClassObject(REFCLSID _rclsid, REFIID _riid, LPVOID *_ppv) {
#ifdef __cplusplus
const GUID *rclsid = &_rclsid;
@@ -292,7 +328,7 @@ STDAPI DllRegisterServer(void) {
module_name = (char *) malloc(allocated);
typelib_name = (char *) malloc(allocated);
#endif
- used = GetModuleFileName(GetModuleHandle("$module.dll"), module_name, allocated);
+ used = GetModuleFileName(SWIGModule /*GetModuleHandle("$module.dll")*/, module_name, allocated);
if (used == allocated) {
#ifdef __cplusplus
@@ -453,5 +489,18 @@ STDAPI DllUnregisterServer(void) {
return S_OK;
}
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
+ LPVOID lpvReserved) {
+ 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";
+ LoadTypeLib(SWIG_typelib_path, &SWIG_typelib);
+ }
+
+ return TRUE;
+}
+
%}