i want to be confirm that isn´t possible to make a generic API (interface) in DLLs developed in VB. That means -- the interface can not be (re-)defined after linking ...
If you see a chance to make it in VB, please, tell me how ...
By the way, do you have any suggestions to solve those problems in VB?
Specially patterns are willcome ...
If you mean you want a non com interface via Vb, that should not be possible.
If you mean you want a Com interface, and once you have it you want
inherit and ovverride, the override is not possible, as far as I know.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
I agree that overriding is not possible, but i want to be sure.
Naturally, I prefer VC++ for generic developments with or without COM. But the customer spend 1.2 M € for a VB development, so i ´ve some resistance ...
Yeah, i ´ve to design an activeX dll, so COM with inheritence is an option.
But i am not sure the core team can handle this...
Perhaps an easy way is to set a static interface in a facade pattern (GoF) and re-design the dll if necessary.
Anyway, thx again.
cu
St. Claus
Last edited by St. Claus; August 17th, 2004 at 04:19 AM.
You could have some C++ components Com compliant...and call them from Vb
(but I do not hold enough knowledge on C++ to tell if this could solve)
One thing more:
In Vb, you can declare Api using aliases, and have "As Any" parameters. Might it
help for what you're looking for (if you can make C++ components under the hood...) ?
In any case, Vb (6.0) inheritance is not a true inheritance, so beware....
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
I start to become nuts to set an inheritance in a semi-oo language like VB.
So i beware now...
By the way, C++ developed normal DLLs are only compilant to VB if there are using C-Syntax in interfaces not C++-Syntax. That means no imports or otherwise exports of C++ classes, member functions and overload functions are possible. In this case you might use COM.
I think may be an array attribute "as Any" type is the best way...
I think may be an array attribute "as Any" type is the best way...
Not with Com, however: that could work with Api (or with your C_non_com
object....)
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Some other insight, you can also use IDL to define the interface and generate a tlb file, You can implements the TLB interface in VB Class, so this is kinda like in C ATL to use a separate typelib to define the interface.
I use this technique so I can recompile my DLL even with no binary compatibility but the client program will still run normally cause it reference the Typelib not the DLL directly.
@Cimperiali:
What´s the trouble concerning array in COM?
Thx.
@Luthv:
Wow, hero stuff! - It works?
...I can recompile my DLL even with no binary compatibility but the client program will still run normally cause it reference the Typelib not the DLL directly.
Means - the old release of dll is in vtable, while you are compiling?!?
Otherwise the app will still crashing after function call. Right?
To say it clear:
- VB client implements a tbl file
- tbl file includes IDL
- IDL defines typelib
- DLL deploys typelib
Where is the dll linking?
Can you tell me a little more about TBL File, please?
Thank you for your great Ideas, too!
regards
St. Claus
Last edited by St. Claus; August 18th, 2004 at 03:05 PM.
Not a big one if you can manage the copymemory Api, or if you are creating a C
dll that could be declared as api function inside a Vb porgram.
Matter is: if you are going to work with vb only, you do not have "as any"
(but ytou could work with "Variant" and "Object" types - only not everithing will
be "coerced to a variant" when it comes the time to move through com: "only "
things "defined in a public creatable class"...Moreover, unless you play under the
hood (with CopyMemory api and few documented Vb instructions like "VarPtr"and
"ObjPtr"), you will not be able to pass arrays byVal...
That is: limitations do exist, but I cannot say they are so big you cannot work
with arrays...it depend more on the whole thing you are making (with Vb only?
with C and Vb?) and how much you can go "under the hood" .
As I am only a Vb develper and do not feel comfortable playing lower-side, I tend
to avoid generic variants in my objects, and work with classes and collection of
classes which become objects I can "marshal" more easily....
As you do not have true inheritrance in Vb, and you cannot overload, you might
have to choose between a few unspecific objects with lot of code to manage all
cases or more objects more specialized that can do each less jobs but are more
focused on their task. I do prefer to have some more object rather than less but
too much complex...
Implementing multiple interfaces
The CBugFilter class presented earlier implemented the IFilter interface. You could
access the IFilter interface or the default _CBugFilter interface through separate
object variables. Think about this for a moment. If you can get two interfaces
through polymorphism, why not three interfaces? Why not 12? Why not 137
interfaces?
[Zipped an extract of that article]
Last edited by Cimperiali; August 19th, 2004 at 06:02 PM.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Make a simple vb dll project.
Before making the dll, go to project properties
Select component tab
check the "make for remote server execution" check box
Now make dll in an empty folder -better you then get that dll, rename it,
set binary compatiblity to it make one more with the original name
(thus without overwriting the old one that you have renamed)-
go inside that folder...any Tlb file there?
Now make a small exe standard project and add a reference to the Tlb file
Can you declare a variable as TheObject.TheCreatableClass you coded in the
dll?
Type libraries are compound document files (.tlb files) that include information about types and objects exposed by an ActiveX application. A type library can contain any of the following:
Information about data types, such as aliases, enumerations, structures, or unions.
Descriptions of one or more objects, such as a module, interface, IDispatch interface (dispinterface), or component object class (coclass). Each of these descriptions is commonly referred to as a typeinfo.
References to type descriptions from other type libraries.
By including the type library with a product, the information about the objects in the library can be made available to the users of the applications and programming tools. Type libraries can be shipped in any of the following forms:
A resource in a dynamic link library (DLL). This resource should have the type TypeLib and an integer identifier. It must be declared in the resource (.rc) file as follows:
1 typelib mylib1.tlb
2 typelib mylib2.tlb
There can be multiple type library resources in a DLL. Application developers should use the resource compiler to add the .tlb file to their own DLL. A DLL with one or more type library resources typically has the file extension .olb (object library).
A resource in an .exe file. The file can contain multiple type libraries.
A stand-alone binary file. The .tlb (type library) file output by the MkTypLib utility is a binary file.
Last edited by Cimperiali; August 18th, 2004 at 05:59 PM.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
I've attach a simple project using tlb and IDL (I compiled the tlb with MIDL.exe from visual Studio). Please register the two tlb's with the utility from vbaccelerator.com. Then run the gTest.vbg.
May be i shoud send two boxes of good german beer as fee. But i can´t find Baby Land on map (and of course beers are not the right drink for kids) and Italians prefer wines i guess.
Ok, gi´me some time to aprove and learn my lessons now.
I´ve to do my job first ...
May be i shoud send two boxes of good german beer as fee. But i can´t find Baby Land[...]and Italians prefer wines i guess
[...]
ciao
Ciao!
But you can send a beer to Luthv, he is really a precocious baby...
And I drink really few, but appreciate both wine and beer...You could
send it by fax or e-mail... ...but you already added to
reputation, so we have been already rewarded...
Have a nice day,
Cesare
Last edited by Cimperiali; August 19th, 2004 at 06:06 PM.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.