i'm developing a COM object that should work in C# and also in VBScript. Also it must support 32 and 64 bits.
The problem I have is with pointers. See part of my .IDL
HRESULT Copy([in] PTRTYPE destAddr, [in] PTRTYPE srcAddr, [in] int bytes);
If I declare PTRTYPE as void*, c# sees them as an IntPtr and VB6/VBScript sees them "As Any"
The problem with this approach is that I cannot do simpler pointer math with "Any" type parameters.
If I declare PTRTYPE as long (and "hyper" in 64 bits), now I can do pointer math but in C# I have two different definitions for the same method depending 32/64 bit platform.
I wish to avoid using VARIANT as PTRTYPE type.
Is there any way to make it compatible with both C# and VBScript?
Thanks in advance, Mauro.
The solution I adopted was the following:
1) Copy .idl to another folder
2) Replace the __int3264 with void* in the variables you want to be IntPtr
3) Build the .tlb file from the .idl one
4) Build a primary interop based on the .tlb file.
Voilá!
Regards, Mauro.