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
5
votes
2 answers

Does Haskell have Something Analogous to Late Binding (or, can we change the definition of functions of an ongoing Haskell program)?

AFAIK, this is a hallmark feature of LISP dialects: For example, suppose we launch an ongoing LISP program that makes repeated calls to some function named func. We are then able to go inside the lisp REPL, change the definition of func, and then…
George
  • 6,927
  • 4
  • 34
  • 67
5
votes
2 answers

virtual function in parent of parent class

The following code is late binding test() method but shouldn't it bind early? because test() method is not virtual in class B(but in class A), and we are using pointer of class B. class A{ public: virtual void test(){ …
Khuram
  • 53
  • 4
5
votes
2 answers

WebBrowser Issue with Late Bind object/property names

There are issue with using WebBrowser late bind calls related to object/property names generation. For example: WebBrowser1.Document.DomDocument.Forms.Myform.mycontrol.Value = "test" will fail with more than one instance of the WebBrowser…
user
  • 51
  • 3
5
votes
2 answers

C# late binding method overloads does not work when overload is defined in a derived class

I need to call method overloads according to the type of object at runtime using c# late binding features. It works fine when all overloads are defined in the same class as the call is happening. But when an overload is defined in a derived class,…
Siamak S.
  • 81
  • 1
  • 5
5
votes
2 answers

late binding in C

How can late binding can be achieved in c language? can anybody please provide an example. i think it can be achieved using dlopen and dlsym but i am not sure about it.please correct me if i am wrong!
Vijay
  • 65,327
  • 90
  • 227
  • 319
5
votes
4 answers

Problem with late binding!

i was asked this question in an interview. late binding is dynamically identifying the symbol during the runtime as far as my knowledge is concerned.please correct me if i am wrong. i was asked a question like what are some of the problem that we…
Vijay
  • 65,327
  • 90
  • 227
  • 319
5
votes
2 answers

How to access Microsoft Word existing instance using late binding

i am developing some code in c# where i will be interacting with Microsoft Word. I want to be able to have the option of re-using an existing instance or as an alternative creating a new instance. Keeping in mind i want to do all of this using LATE…
Grant
  • 11,138
  • 32
  • 94
  • 140
5
votes
1 answer

Excel Late Binding EntireColumn.NumberFormat

How to set the Range.EntireColumn.NumberFormat using the late binding? I am currently have this code: object rg = ws.GetType().InvokeMember("Cells", BindingFlags.GetProperty, null, ws, new object[2]{1,iCol}); object ec =…
5
votes
2 answers

How to latebind COM event without interface

I need to late bind to a 3rd party VB6 COM object in a 3.5 C# application (to avoid version dependencies that we currently have). The dll that was provided is not consumable in most non-latebound ways due to some bug that causes errors when we try…
Justin Pihony
  • 66,056
  • 18
  • 147
  • 180
5
votes
2 answers

Late Binding COM objects with C++Builder

We're interfacing to some 3rd party COM objects from a C++Builder 2010 application. Currently we import the type library and generate component wrappers, and then are able to make method calls and access properties in a fairly natural…
Roddy
  • 66,617
  • 42
  • 165
  • 277
4
votes
2 answers

How do I call a VB6 COM object from C# with dynamic when it has a ref parameter?

I have the following legacy VB6 function that I want to call from C#. Public Function CreateMiscRepayment(ByRef objMiscRepayment As MiscRepayment) As Variant ' Code that sets objMiscRepayment here End Function I'm using the following code in C#…
John Mills
  • 10,020
  • 12
  • 74
  • 121
4
votes
1 answer

Late Binding C++ DLL to C# - Function always returns true

I have an DLL that has this in its h file: extern "C" __declspec(dllexport) bool Connect(); and in the c file: extern "C" __declspec(dllexport) bool Connect() { return false; } In c# i have the following…
Nitay
  • 4,193
  • 6
  • 33
  • 42
4
votes
4 answers

Using early binding on a COM object

I have this piece of code that works very well and gives me the path the user's start menu: Dim oShell As Object = CreateObject("Shell.Application") MsgBox(oShell.NameSpace(11).Self.Path) This obviously uses late binding. Now say I want to…
Laurent
  • 5,953
  • 14
  • 43
  • 59
4
votes
2 answers

how to implement LateBinding in C#

I'm having a general class in that class i've written one method which should accept the object class's object as parameter. the function is as follows- protected void AddNewForm(object o ) { try { o.Show(); } catch…
Priyanka
  • 2,802
  • 14
  • 55
  • 88
4
votes
1 answer

Can the Java compiler do early binding for non-static methods?

Let's say that I have the following class: public class MyClass { public void doSomething() { System.out.println("doing something."); } } Let's further assume, that all my project does is to call that .something() method. No…
Martin J.H.
  • 2,085
  • 1
  • 22
  • 37