Questions tagged [late-binding]

Late binding is a mechanism in which the method being called upon an object is looked up by name at runtime.

Late binding is a mechanism in which the method being called upon an object is looked up by name at runtime.

The specific type of a late bound object is unknown to the compiler at compile time. This is contrasted with early binding, where relationships between objects, methods are properties are established during compile time.

It is expected that questions tagged specifically relate to programming using late bound code. You should also tag your post with the specific programming language being used.

Example (VBA):

' late bound objects are declared As Object
Dim obj As Object
Set obj = CreateObject("Excel.Application")

Related Tags:

353 questions
4
votes
1 answer

In Django, how do I late-bind an unbound form?

I generate a form dynamically: form = forms.Form() form.fields['myname'] = forms.CharField(label=u'My Name') ... and then show the form with: buf = '....
...' + form.as_p() + '...' t = Template(buf) v =…
Raja
  • 41
  • 3
4
votes
2 answers

How do you instantiate an object that is not included in your C# project?

Note: All sample code is greatly simplified. I have a DLL defined as: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Web; namespace RIV.Module { public interface IModule …
Keith Barrows
  • 24,802
  • 26
  • 88
  • 134
4
votes
4 answers

How to force calling only superclass's methods despite that they have been overridden (in Ocaml)

To be honest, I don't know much about OCaml's object system. The following snippet illustrates my problem: class foo = object (o) method foo1 y = print_endline "foo1"; o#foo2 (y - 1) method foo2 y = print_endline…
ulricha
  • 123
  • 4
4
votes
3 answers

How to do late binding in VBA?

I have a function that creates an email via VBA. I made this through Excel 2016. When some of my colleagues try to use it there an error of missing references (Outlook Library 16.0). I looked in the internet for solutions and found the best is Late…
Franco Sica
  • 51
  • 1
  • 1
  • 3
4
votes
2 answers

Which is the proper way to work with LateBinding in Delphi?

actually i am using late-binding in delphi, and i need to know wich is the proper way to work with it. My principal concern is about how I handle the memory used by these objects, I must free the memory? check this sample code var chEaten:…
Salvador
  • 16,132
  • 33
  • 143
  • 245
4
votes
2 answers

C++ Late Binding on function overloads

Assuming I have these two classes: class Hello { //members public: virtual int doit() { return 3; } }; class Wow : public Hello { //members public: virtual int doit() { return 2; } }; int main(int argc,…
NoImaginationGuy
  • 1,795
  • 14
  • 24
4
votes
2 answers

Javascript closure returning a recursive function

I'm new to Javascript and functional paradigms. I really like using closure to keep little bits of state wrapped up safely in a private scope. It's a refreshing change from the song and dance of class worship in Java. I wrote the following code…
kdbanman
  • 10,161
  • 10
  • 46
  • 78
4
votes
3 answers

How do you override bindings up a JS constructor chain?

I'm trying to define a base class in JavaScript that performs a lot of common functionality upon creation. Part of that functionality is to create a component and register callback handlers to that component. The problem I'm having is how to…
4
votes
2 answers

Loading a generic type using Assembly.LoadFrom

Referring to the answer by Jon Skeet here: Pass An Instantiated System.Type as a Type Parameter for a Generic Class I need to load a Generic type based on the name of the generic type, and the name of the type that is the type parameter for the…
Jon Egerton
  • 40,401
  • 11
  • 97
  • 129
4
votes
4 answers

How to Pass a Late Bound Parameter

In VB6, I'm trying to pass a late bound object to another form. frmMain.vb Dim x Set x = CreateObject("MyOwn.Object") Dim f as frmDialog Set f = New frmDialog f.SetMyOwnObject x frmDialog Dim y Public Sub SetMyOwnObject(ByVal paramX As Variant) …
ssorrrell
  • 659
  • 1
  • 8
  • 19
4
votes
1 answer

Why early binding is resolved at compile time if the actual object is determined at runtime?

I know that all objects are created at runtime when the function is called. Binding is when we bind methods data members inside the class. early binding is binding all the method instance variables at compile time. I thought all objects are created…
user1393669
  • 43
  • 1
  • 2
3
votes
2 answers

Dynamic Binding Example in C++

This piece of code is a classical example of dynamic binding in Objective-C [1]: float total = tareWeight; // start with weight of empty container int i, n = [self size]; // n = number of members for (i = 0; i < n; ++i) { // loop over…
sidyll
  • 57,726
  • 14
  • 108
  • 151
3
votes
2 answers

Can I use late binding to check the existence of a library before using it via early binding?

I like to use early binding in my VBA projects, since I like the auto-complete of method names, etc. during development. I also like the confidence of knowing that the compiler will warn me if I've mis-spelled a method name. However, to use early…
Gary McGill
  • 26,400
  • 25
  • 118
  • 202
3
votes
2 answers

Late binding to a library with "extern" defined variables

I'm trying to late bind my program to a DLL. I know how to import its methods but in one its header files, I have a definition like this: EXTERN_C const IID SomeVariable; How can I refer to this variable in my program without getting the…
Idov
  • 5,006
  • 17
  • 69
  • 106
3
votes
1 answer

I want to create a generic selector for 2D array in C

In case if 2d array is of float type I want to call the first function and otherwise the second, how can I accomplish this? void printff(int n,float m[n][n]) { for(int i=0;i
Bhaumik_Tandan
  • 117
  • 1
  • 4