Re: Calling COM Components from Vim (Win32)

2006-10-15 Thread Yukihiro Nakadaira

Although this is still a bit inconvenient, it is possible to keep DLL
loaded by incrementing reference count itself.

/* test.c */

#ifdef WIN32
# include windows.h
#else
# include dlfcn.h
#endif

#ifdef _MSC_VER
# define EXPORT __declspec(dllexport)
#else
# define EXPORT
#endif

EXPORT int load(char *path);
EXPORT int count();

int load(char *path) {
#ifdef WIN32
 return (LoadLibrary(path) != NULL);
#else
 return (dlopen(path, RTLD_LAZY) != NULL);
#endif
}

static int x = 0;

int count() {
 return ++x;
}



 test.vim

let dll = has(win32) ? test.dll : test.so
call libcallnr(dll, load, dll)
for i in range(10)
 echo libcallnr(dll, count, 0)
endfor


--
Yukihiro Nakadaira - [EMAIL PROTECTED]


Calling COM Components from Vim (Win32)

2006-10-14 Thread Eric Smith

Hi,

I've scanned the vim-dev archives looking for any suggestions for and/or 
attempts at creating a means of calling dual-interface COM objects from 
within the Win32 version of Vim, and come up empty.


IMHO, this would be a useful feature for extending Vim script to do some 
very powerful things.  For instance, advanced code completion could be 
plugged into Omni.


I apologise if a thread covering this issue has already been raised 
(with a satisfactory conclusion)---if so, could someone direct me to it?


I am aware of libcall, but it's somewhat limited and I stopped 
considering writing a Published DLL function to COM marshaller 
(already a contrived hack) after becoming aware that directly after the 
call Vim unloads the DLL.


So,

1.  Have I completely missed the boat, and *there is* already something 
that does this?
2.  If No to 1), is there any particular reason why this would not be 
worth the effort?


Thanks,

--Eric


Re: Calling COM Components from Vim (Win32)

2006-10-14 Thread Martin Stubenschrott
On Sat, Oct 14, 2006 at 03:44:33PM +0200, Eric Smith wrote:
 I've scanned the vim-dev archives looking for any suggestions for and/or 
 attempts at creating a means of calling dual-interface COM objects from 
 within the Win32 version of Vim, and come up empty.
 
 IMHO, this would be a useful feature for extending Vim script to do some 
 very powerful things.  For instance, advanced code completion could be 
 plugged into Omni.

Since COM objects are only Win32, I don't think that will help much with
omni completion, because at least those omni completion systems shipped
with vim by default should be as cross-platform as possible.

--
Martin