The exe that refers to tlb, the import function adds GetMem8, and there is no DllFunctionCall, so the function call of GetMem4 will be quite fast (because the function of Declare first calls the DllFunctionCall function, and then the GetMem4 function is called by DllFunctionCall), and the reference to tlb saves Lost this intermediate link
Re: how to make tlb by vb6 for Declare windows api
Compiled code does not use type libraries, type libraries are just a form of partially compiled symbol table information. TLB files and resources are really just source code used by compilers and other development tools such as IDEs.
GetMem4() and friends are not part of the Windows API, they are entrypoints in VB runtime libraries.
I'm not aware of any useful "cookbook" tutorials on manually writing the MIDL/ODL (IDL) to compile into standalone TLBs. Most people just study existing examples, supplementing that by decompiling existing TLB files using the OLEView tool or something similar for ideas on how to handle different things.
Re: how to make tlb by vb6 for Declare windows api
I remember Bruce McKinney providing "his" source-code for "his" WinApi-TLB in "Hardcore Visual Basic".
I took that as a starting point and wrote my own TLB for the ODBC-dll, basically doing what dilettante described: Take an existing example, and try (and error) to change it to your needs.
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Re: how to make tlb by vb6 for Declare windows api
Some people make hundreds or thousands of APIs into a single TLB file.
Is it possible to use other tools to delete a few of it?Or modify the parameter type for each item.
Re: how to make tlb by vb6 for Declare windows api
Originally Posted by xiaoyao
Some people make hundreds or thousands of APIs into a single TLB file.
Is it possible to use other tools to delete a few of it?Or modify the parameter type for each item.
Why would you delete an entry? Whatever for?
You only need a TLB during developement (a.k.a. you don't have to ship it with your app), and only those entries you actually use in your app get "compiled" into your app.
There is no penalty for TLB-Entries you don't use (contrary to writing declares!)
Modifying a parameter-type is easy if you know the syntax. Then just recompile.
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Re: how to make tlb by vb6 for Declare windows api
I also noticed that the compiled exe will not run faster just because u have a tlb.
my experience is that u will not notice much difference.
the purpose of a TLB is that u dont need to add all those API in your module, the same with the countless structures/udt and const variables.
speed is about thinking how memory works, what will be the fastest way for the memory to do something.
and thats string and graphics, those 2 eat a lot of time. so better focus on learning more about optimization.
and as many already posted, when compiled only the used parts will be added to the table, so it doesnt matter if the tlb is gigantic in size.
Re: how to make tlb by vb6 for Declare windows api
Agree with baka.
another bottleneck is the algorithm itself.
nested loops come to mind.
or harddrive-access
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Re: how to make tlb by vb6 for Declare windows api
Originally Posted by Zvoni
only those entries you actually use in your app get "compiled" into your app.
There is no penalty for TLB-Entries you don't use (contrary to writing declares!)
I'm sorry if I got it wrong. But do you mean if within the TLB there are 1000 declarations, and I only use 2, then the compiler will only take two declarations at the time of compilation?
Re: how to make tlb by vb6 for Declare windows api
Originally Posted by Episcopal
I'm sorry if I got it wrong. But do you mean if within the TLB there are 1000 declarations, and I only use 2, then the compiler will only take two declarations at the time of compilation?
Maybe you don't believe that type library entries add no overhead to your programs except for the entries you use. Maybe you don't believe that type library entries add no overhead to your programs except for the entries you use.
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Re: how to make tlb by vb6 for Declare windows api
Originally Posted by baka
I also noticed that the compiled exe will not run faster just because u have a tlb.
my experience is that u will not notice much difference.
Actually it will run faster, but unless you are making tons of calls as within a long running loop you won't notice any performance gain. So, just like anything.
Type libraries don't even need to be registered unless you want to search the registry to locate them on disk. For example adding via the VB6 IDE References dialog. Once added to the Project there is no need for the TLB to be registered.
Example that grabs ANSI data, then converts it to lower-case Unicode to find and count the different non-number "words" in it:
Replace the text input file with a larger one to really see the performance.
This makes use of a TLB to call entrypoints in a number of different libraries, but mainly in shlwapi.dll for parsing. it can probably be even faster if you replace the xxxW calls with xxxIA (case-insensitive ANSI) calls, only converting "words" to Unicode to display them at the end.