First time DLL user help

Just starting out? Need help? Post your questions and find answers here.
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

First time DLL user help

Post by AndyMK »

I have a dll and i can list all its function names and addresses. Do i just use callfunction commands or can i use prototypes? If so how? The docs say that prototype is better?

These are the commands listed:

Code: Select all

_ENetCheckEvents@12
_ENetConnect@8
_ENetCreate@24
_ENetDeInitialize@0
_ENetDisconnect@4
_ENetDoEventCheck@4
_ENetGetNumClients@0
_ENetInitialize@0
_ENetSendData@16
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: First time DLL user help

Post by skywalk »

ts-soft to the rescue...
http://www.purebasic.fr/english/viewtop ... edllhelper
Definitely use prototypes.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Re: First time DLL user help

Post by AndyMK »

Thanks :)
UrgentKettle
User
User
Posts: 12
Joined: Thu Jan 27, 2011 12:25 pm

Re: First time DLL user help

Post by UrgentKettle »

If you have the lib file then you can use IMPORT. If you only have the DLL then you can either use PROTOTYPES (which also gives the benefit of detecting the presence of the DLL at runtime) or use the DLL importer utility in the PureBasic SDK (..\purebasic\sdk\dll importer).

I find that the PROTOTYPE method is the best as it gives you parameter hints in the IDE when using the functions. It is slightly more work to write the code for PROTOTYPE but worth it IMHO.
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Re: First time DLL user help

Post by AndyMK »

I done it with prototypes in the end and it works nice BUT the lib does not include any functions to get the ip or port for a connected client so its useless :( .. I am trying to do some udp holepunching and having reliable udp would have made it much easier.
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Re: First time DLL user help

Post by AndyMK »

Is it possible to access structures inside the dll?
Post Reply