Method to check function declared or not in .dll file - dll

Is there any tool by the help I can find whether a function is declared in .dll file or not.
Actually I am stuck in a problem where compiler is saying that it could not find the definition of xyz method.
Please if anyone know how can I check this thing,please Share.
I want to test msxml6.dll
Thanks

I don't know this specific DLL but you can use decompiler as IlSpy (only if this is .Net dll) for reverse engineering the dll and check if the function is there.
Update
Now I see from the tags that this is C++ so decompiler won't help here.

Related

Why/when TypeLib should be registered?

This is what I think I know:
TypeLib only descripes "what should be out there" (=How to locate and call the actual class)
If .tlb -file (=TypeLib) is imported in C++ -code at compile time, the compiled code already contains all information "what should be out there".
Interop -assembly (.NET) is pretty much the same as .tlb -file. It's only in assembly-form so that the .NET code can be compiled against it, but also contains info only about "what should be out there".
If interop in embedded, its TypeLib-info is included in the assembly and there's no need to deploy separate interop-dll when the application is deployed.
If the interop is not embedded, the interop-dll must be deployed to the same folder as the calling assembly so that the info can be found by the caller.
Of course the actual classes that the TypeLib is pointing to must be registered so that they can be found from the depth of the machine with the TybeLib-info.
Please correct me, if something above is wrong.
My question is, based on above "knowledge", why I sometimes see articles/questions/tutorials about REGISTERING TYPELIBs? It just doesn't make any sense to me (yet), since registering them shouldn't provide any excess information for the caller.
Thank you.

how to import COM dll in D

I'm trying to create an D application which uses a (third party) COM .dll so I can scrape a text box of another application so I can sound an error when a certain string shows up.
However the third party doesn't provide .lib, .def or .h files that go with the dll (atleast with the free trial version). I can create the .lib file with the implib tool but I don't see any of the library's functions in the created .lib.
Their (visual c++) samples use the #import directive to link it in however that is of no use for me ...
On a side note how can I get the proper interfaces (in a .di with boilerplate that does the linking) of the dll automatically? I ask so the correctness of the linkage doesn't depend on my (likely to be incorrect) translation of the functions. They do have a webpage which gives all functions but the object model is a bit chaotic to say the least.
From what I know, COM libraries only expose a few functions, required to (un)register the library and to create objects.
You can however view the interfaces and functions in a COM .dll using the OLE/COM Object Viewer. It seems it might be able to output header files (.h). Afterwards, maybe you could use htod as a starting point to converting everything to D interfaces.
The DMD distribution seems to include a .COM sample (chello.d, dclient.d, dserver.d), and at first glance it doesn't look like it would require any LIBs explicitly.
Unfortunately, I've never actually used COM in D, so I can't advise any further. I hope this helps in some way.
While I have yet to actually do COM work myself, I am trying to revive Juno over on Github/he-the-great. Part of the project is tlbimpd which is what will output a D file from a DLL.
I've tested the examples and successfully run tlbimpd. Please do try things out for your use and submit any issues.

Get IDL code from TypeLibrary programmatically

I am writing code to perform the following steps;
Register a .net .dll and generate a .tlb using regasm.exe
Register a .net .dll and generate a .tlb using regasm.exe
Generate the IDL code from the typeLibrary and store it in a file.
Edit the IDL code making minor changes.
Recompile the IDL into a .tlb using Midl.exe.
The step I am stuck on, as I am sure you have guessed, is the generation of the IDL. I know this can be done manually by using the OleViewer that comes with the Windows API, however I would like to remove this manual step.
I cant seem to find anyway to operate the OleViewer via command line or find any other method of generating the IDL code.
Anybody got any ideas? I know the code to generate the IDL must be in the OleViewer somewhere... perhaps there is a way to access it?
Wine has an open source implementation of oleview
http://source.winehq.org/git/wine.git/tree/HEAD:/programs/oleview
Perhaps you'd be able to use the idl enumeration functions in typelib.c
http://source.winehq.org/git/wine.git/blob/HEAD:/programs/oleview/typelib.c

Meaning of building a dll as export library

What is the meaning of building a dll as export library ? I just googled it.I found its a dynamic link library.Can anyone please explain what actually dll is ? and why do we need to add these statement in the .dll file
extern "c" _declspec(dllexport)
I studied the static and shared libraries but Im not sure why do we go for dll files.I learnt .dll is used for the run time. But can you help me and give me more information.Thank you in advance
I may have been a bit harsh in my comments. I am not an authority on dlls, but I have a bit of working knowledge of them, so I will try to give a short explanation.
The difference between static and shared libraries should be easy to find in a web search, but basically the code in a static library gets included into the final executable, so after the linking stage, the actual library file is not needed anymore to run the program; on the other hand, code in a shared library doesn't get included in the main program - the two parts remain separate, so the shared library (called dll on windows) will be needed every time the program is run.
"Building a dll as export library" is a bit of a confusing term. I had not heard of it before, and during a short search could only find it on a cygwin page, which you might have read, considering your initial tags. A dll can export some or all of its functions and data. Exporting means that they are available for other programs and dlls to use. Which names get exported can be controlled in various ways. One of those is inserting _declspec(dllexport) in the declaration of the function. Another way is by using a definition file with an exports section.
When creating a dll, an import library can be created. This is a file that can then be used when building an executable that uses the dll, during the linking stage, to let it know which names are exported from the dll, so the program knows how to resolve references to those functions; in other words: how to import them. (This is not always necessary. Many linkers allow you to directly link against the dll itself, thereby removing the need for an import library.)
I realize it can be confusing, but try to find a tutorial and some small examples to see how it works, and play with it a bit.

reference to c++ dll

I was add to my program reference to dll and it's work good.
Declare Function adc11_get_driver_version Lib "C:\example.dll" () As Integer
but I want to write the specific location of the dll from file(config file) and replace the "C:\example.dll" by string
how can I do this?
thanks
Saar
I think you need to do dynamic PInvoke. One way to do this is using the LoadLibrary function to load the library before .Net tries to find it. You can find some sample code here.
If you leave out the location completely, it will load it based on the current directory of the application. If it's not there, then it looks in the PATH.
If you want to do something more complex, then you need to write the LoadLibrary and GetProcAddress calls yourself in your own proxy.
Some guidance here:
http://www.codeproject.com/KB/cs/dyninvok.aspx