Re: Creating a DLL with a ActiveX interface.

2015-09-17 Thread Taylor Hillegeist via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 16:08:47 UTC, Taylor 
Hillegeist wrote:

export extern (Windows) void SayHello(Variant *Input_Variant)
{
string A = "HELLO WORLD!";
Input_Variant.CA_VariantSetCString(A.ptr);
}



So I made a terrible error. Looking at 
http://lunesu.com/uploads/ModernCOMProgramminginD.pdf
of the http://dlang.org/interface.html page I was given the 
impression that std.variant was a transparently equivalent to the 
com VARIANT. however:


std.variant != VARIANT for com

if anyone knows how to easily convert between the two i would be 
happy to know.


I did find a nice library for VARIANT: 
https://github.com/JesseKPhillips/Juno-Windows-Class-Library


Re: Creating a DLL with a ActiveX interface.

2015-09-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 17 September 2015 at 17:58:49 UTC, Taylor Hillegeist 
wrote:
if anyone knows how to easily convert between the two i would 
be happy to know.


You'll just need to write an adapter... I started a minimal one 
here:


https://github.com/adamdruppe/com/blob/master/comhelpers.d#L123

but it was just getting... and I only supported string and int. 
But the same basic idea is both ways, break it up into basic 
families of types (string, int, float, pointer, whatever else) 
and convert to from by manually setting the type thing.


Re: Creating a DLL with a ActiveX interface.

2015-09-16 Thread Taylor Hillegeist via Digitalmars-d-learn

On Monday, 14 September 2015 at 16:59:20 UTC, Adam D. Ruppe wrote:
On Monday, 14 September 2015 at 15:44:36 UTC, Taylor Hillegeist 
wrote:
So, Actually I am using NI LabVIEW to interact with my DLL. I 
imagine even getting hold of of that would troublesome or 
expensive.


Ah, all right. Here's a SO thing (followed up by email then


Fortunately I am working with Win7, And the below function seems 
to work beautifully.


export extern (Windows) void SayHello(Variant *Input_Variant)
{
string A = "HELLO WORLD!";
Input_Variant.CA_VariantSetCString(A.ptr);
}

My goal was to store variants in an associative array 
Variant[string] and use this as a portable interpreter returning 
the resulting Variant.


but that runs into some memory questions that I am not as savvy 
with.


1. Memory:
I need to manage memory from the dll. I can give the caller a 
pointer to manage, but I don't think that is visible from gc. 
There should be different associtive arrays for different objects 
in the caller. How do I manage this?


2. Threads:
I would like this to be as parallel as possible one objects call 
to its data should not hinder anothers.


I have seen on the Memory managment page 
http://wiki.dlang.org/Win32_DLLs_in_D  but I would like to know 
more.






Re: Creating a DLL with a ActiveX interface.

2015-09-14 Thread Taylor Hillegeist via Digitalmars-d-learn

On Monday, 14 September 2015 at 15:20:50 UTC, Adam D. Ruppe wrote:
On Monday, 14 September 2015 at 15:14:05 UTC, Taylor Hillegeist 
wrote:

Gives a short example but the code doesn't compile for me.
core\stdc\windows\com.d seems to be missing?


I think the doc copy/pasted a typo there. It should be 
`core.sys.windows.com`.



I've done some COM stuff with D before, getting it callable 
from vbscript and jscript. Can you tell me what steps you're 
using (in some detail, like are you using IE? or some other 
thing?) to test your thing? then I can try to make a working 
example that passes it and share that.


So, Actually I am using NI LabVIEW to interact with my DLL. I 
imagine even getting hold of of that would troublesome or 
expensive. But I'm pretty savvy on that end. But for me its more 
about how to expose an com interface to the rest of the system 
through a dll.


Re: Creating a DLL with a ActiveX interface.

2015-09-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:14:05 UTC, Taylor Hillegeist 
wrote:

Gives a short example but the code doesn't compile for me.
core\stdc\windows\com.d seems to be missing?


I think the doc copy/pasted a typo there. It should be 
`core.sys.windows.com`.



I've done some COM stuff with D before, getting it callable from 
vbscript and jscript. Can you tell me what steps you're using (in 
some detail, like are you using IE? or some other thing?) to test 
your thing? then I can try to make a working example that passes 
it and share that.


Re: Creating a DLL with a ActiveX interface.

2015-09-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:44:36 UTC, Taylor Hillegeist 
wrote:
So, Actually I am using NI LabVIEW to interact with my DLL. I 
imagine even getting hold of of that would troublesome or 
expensive.


Ah, all right. Here's a SO thing (followed up by email then 
copy/pasted there) I did for someone else with a hello COM dll:

http://stackoverflow.com/questions/19937521/what-are-options-to-communicate-between-vb6-com-server-on-windows-xp-and-python

The main thing is dealing with a bug in Windows XP. If you are on 
Vista or above, you can skip that and hopefully just look at the 
example zip here:




http://arsdnet.net/dcode/com.zip

That's almost two years old now but should still basically work 
(I will try next time I have a free hour on Windows too) and 
hopefully get you started.