digitalmars.D.learn - Creating a DLL with a ActiveX interface.
- Taylor Hillegeist (15/15) Sep 14 2015 So, I've looked at this topic of COM OLE and activeX, and found
- Adam D. Ruppe (9/11) Sep 14 2015 I think the doc copy/pasted a typo there. It should be
- Taylor Hillegeist (6/17) Sep 14 2015 So, Actually I am using NI LabVIEW to interact with my DLL. I
- Adam D. Ruppe (12/15) Sep 14 2015 Ah, all right. Here's a SO thing (followed up by email then
- Taylor Hillegeist (24/30) Sep 16 2015 Fortunately I am working with Win7, And the below function seems
- Taylor Hillegeist (12/17) Sep 17 2015 So I made a terrible error. Looking at
- Adam D. Ruppe (9/11) Sep 17 2015 You'll just need to write an adapter... I started a minimal one
So, I've looked at this topic of COM OLE and activeX, and found myself confused. http://dlang.org/interface.html Gives a short example but the code doesn't compile for me. core\stdc\windows\com.d seems to be missing? And i cant find any documentation on core\stdc on the standard library page. http://wiki.dlang.org/Win32_DLLs_in_D Points to "The Sample Code" under COM. but I find that confusing. So here is what I desire, You guys can let me know how dumb it is. I want a dll with an activex x interface, that contains a small bit if data a string for example. And this is what i want to happen? (caller sends activex object with string)->(my dll written in d minpulates string)->(caller gets a diffrent string) I call on the wisdom of the community to help me in this. Thanks!
Sep 14 2015
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.
Sep 14 2015
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: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.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.
Sep 14 2015
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.
Sep 14 2015
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: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.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
Sep 16 2015
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
Sep 17 2015
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.
Sep 17 2015