473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to use bind.exe (windows)

20
Hello everyone,

I am unsure how to invoke bind.exe from windows platform sdk. Looking for an example. The context here is how to bind a particular DLL to a calling program. Suppose that the caller is caller.exe and the dll is ydll.dll. How would I invoke bind.exe ?

Thanks,
Mark Allyn
Aug 21 '10 #1
4 3399
weaknessforcats
9,208 Expert Mod 8TB
I believe you are talking about using the #import preprocessor directive at compile time.

I think #import is Microsoft-specific and so I would research this in MSDN.

#import assumes the dll is on project folder and it it's not you need to prvode a path to it by using your tools/options of VC++.
Aug 22 '10 #2
allynm
20
Hi Weaknessforcats,

Thanks for thinking over my query. I really appreciate your time and effort.

I don't think bind.exe is related to preprocessing. Of course, I could be wrong. I have become extremely wary and insecure in matters of this sort.

Bind.exe is a program available exclusively in Microsoft Platform SDK. My understanding is that it binds specific DLL exports to the IAT of a process. Thus, it alleviates the look-up problem the loader has at run-time. In one sense, it sort of defeats the purpose of having a DLL but the benefit seems to be faster program linking. Or, so it appears....to the unwashed (me).

I have done some exploration in MSDN documentation. The results have been quite disappointing. It appears to be sort of a forgotten program. And yet, one of the MSFT linker options specifically prohibits binding if invoked which suggests that at least at some point MSFT cared about binding. One can indeed read about binding on Wikipedia in their entry on DLLs.

The program is "for real". Or so it seems..

Regards,
Mark Allyn
Aug 22 '10 #3
weaknessforcats
9,208 Expert Mod 8TB
Usuallly you LoadLibrary at run time. Then using the returned HMODULE you call GetProcAddress using your function name ands then you typecast the returned FARPROC to a function pointer of the correct arguments and return type.

If your DLL suppports __declspec(dllexport) for the functions you want to call, then when the DLL is built a .lib file is created along with the .dll.

This .lib can be used as a static library but when you call a functon in this lib you actaully call a wrapper that itself does the LoadLibrary, GetProcAddess and
typecast for you.

It appears the DLL is statically linked you to your code.

Would this get you what you want? If so, check this out in MSDN.
Aug 22 '10 #4
allynm
20
Hi Weaknessforcats,

Thanks for your very compact and comprehensive reply. Your description of loadlibrary/getprocaddress is spot-on. I have written exactly this kind of code for explicit linking. (for some reason, I always have to go back and teach myself about function pointers every time I do this...)

What had prompted my interest in BIND.exe goes back to my investigation of how the PE header works, and indeed, therefore, how the loader does its thing when it loads DLL's. In going through this maze I ran across references to BIND.exe and I was trying to discover how to use it and watch it at work with OLLY. There are very few fleeting references to BIND.

In short, this is hardly a mission critical issue for me. But, I am the sort of nit-wit who wants to know how EVERYTHING works....

Regards as always,
Mark
Aug 22 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Guillaume Kaddouch | last post by:
Hi, I am in trouble since many days because i'm facing a problem that i can't solve. I used to play with RAW socket under Linux, but the near same code ported on Windows doesn't works, and i...
7
by: USUN_TO | last post by:
Hi, i got problem when i bind in this way: local_addr.sin_family = AF_INET; local_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); local_addr.sin_port = htons(CLIENT_PORT); i can easly bind...
1
by: Strategic Mind | last post by:
The bind error messages below are returned when running the db2batch command on Windows NT against an AS/400 database. Most batch scripts are running without error. What files and and command...
3
by: Dmitry Korolyov [MVP] | last post by:
Is that possible? In other words, I want a dropdown list (and other list-type controls) which appears in edit more of a templated column to be populated with data at the run time. An attempt to do so...
4
by: Greg Linwood | last post by:
I am wondering what the best approach to binding XML data to an asp:Table from the Page_Load event in a code behind module? I'm using VB.Net and initially approached this by adding a table to the...
8
by: J.S. | last post by:
I was under the impression that frames could be used in Windows forms in earlier version of VB. However, in VB 2005 Express I don't see any such tool/control. Is SplitContainer used for this...
8
by: Mark Rowland | last post by:
Please bear with me, as I am a newbie in the world of databases and DB2. We are trying to migrate an application that binds to a DB2 database (Workgroup Edition, V6.1) from a server running Windows...
4
by: peter | last post by:
I've come across a weird difference between the behaviour of the Tkinter checkbox in Windows and Linux. The issue became apparent in some code I wrote to display an image in a fixed size canvas...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
3
by: forum.microsoft.com | last post by:
I am trying to bind windows form checkbox in Sql and bind the checkbox to sql. I tried representing checkstate as integer 1 for true otherwise integer 0. That does not work. I tried binding to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.