Importing DLLs

Windows specific forum
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Importing DLLs

Post 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
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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.
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post 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 :)
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
VPureBasic
User
User
Posts: 59
Joined: Fri Apr 25, 2003 6:09 pm
Location: Quebec - Canada

Post 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
Everything is possible with PureBASIC... All you're missing is imagination!
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2148
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Post by Andre »

I think the FMod Dll Wrapper written by Danilo & Froggerprogger is a good example for this, isn't it ?
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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.
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post 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).
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post 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.
SPAMINATOR NR.1
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post 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.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Post Reply