Page 1 of 1

Importing DLLs

Posted: Sat May 10, 2003 2:04 pm
by tinman
Is there an easier way to import DLLs (which are not created by me and I do not have anything other than the DLL and header files) then to use something like pexports/impdef*, manually edit the resulting def file to make it look like a .pbl file and then use the DLLImporter tool?

pexports 0.43 can be found at:
http://www.imem.unavarra.es/3d_mec/download/win2k/

impdef is Borland's tool, available with their free compiler:
http://www.borland.com

Posted: Mon May 19, 2003 2:05 pm
by GedB
Tinman,

I thought PB could just use Dlls with OpenLibrary.

Under which circumstances would this hack be needed?

Is OpenLibrary restricted to just Powerbasic Dlls?

Thanks,

Ged.

Posted: Mon May 19, 2003 8:21 pm
by tinman
GedB wrote: I thought PB could just use Dlls with OpenLibrary.
Under which circumstances would this hack be needed?
Is OpenLibrary restricted to just Powerbasic Dlls?
Yes, PB can use any kind of DLL using OpenLibrary.

However, I was looking for a way to import them so they look like normal PureLibraries. That way you can just call the function names, just as you would with the API functions, and not have to mess around with open library and so on.

And it's not a hack :)

Posted: Mon May 19, 2003 9:36 pm
by VPureBasic
Hi Tinman,

You can use any DLL's with PureBASIC without "OpenLibrary" or any other call functions...

Try this:
a) Copy the *.lib in the PureLibraries\Windows\Libraries
b) Write a .pbl file for this DLL
c) Use the file made with "DLL Import" and copy it to PureLibraries\Windows\

After that PB will be able to call any function from this new dll. ( Do not forget the underscore at the end... )

Roger

Posted: Mon May 19, 2003 10:42 pm
by Andre
I think the FMod Dll Wrapper written by Danilo & Froggerprogger is a good example for this, isn't it ?

Posted: Tue May 20, 2003 10:25 am
by GedB
tinman wrote:And it's not a hack :)
Thats a relief :D

I look forward to finding out about all this library stuff.

Posted: Tue May 20, 2003 7:45 pm
by tinman
VPureBasic wrote:Try this:
I know, that is what I am asking about and have done. I was wondering if there was an easier way.

The part about write a pbl file is what I have most hassle with. Why do we need to write this by hand when pexports or impdef can get all the information from the DLL file? (It's a pain in the ass to have to type hundreds of function names rather than just extract them automatically).

Posted: Wed May 21, 2003 7:37 am
by Rings
tinman wrote:(It's a pain in the ass to have to type hundreds of function names rather than just extract them automatically).
give the developers a chance to fix that.

Posted: Wed May 21, 2003 5:48 pm
by tinman
Rings wrote:
tinman wrote:(It's a pain in the ass to have to type hundreds of function names rather than just extract them automatically).
give the developers a chance to fix that.
Sure, they can fix it if they want, I know I will appreciate it.But that doesn't help me now. How do I even know if it is being worked on?

I don't think I'm not giving them a chance, I'm just pointing out it's a pain in the ass (the way it works now) and was asking if there was an easier way.