Unmanaged DLL

Just starting out? Need help? Post your questions and find answers here.
boop64
User
User
Posts: 14
Joined: Tue Nov 18, 2003 12:42 pm
Contact:

Unmanaged DLL

Post by boop64 »

Is there anyway to call functions from an unmanaged DLL inside of purebasic? OpenLibrary doesn't seem to quite be cutting it.

A good example in C++.

http://blogs.msdn.com/b/jonathanswift/a ... 80637.aspx

Edit.... I included the wrong link previously

Thanks,

boop64
Last edited by boop64 on Thu Mar 08, 2012 3:31 am, edited 1 time in total.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Unmanaged DLL

Post by ts-soft »

I can't see any problem with Openlibrary:

Code: Select all

PrototypeC MultiplyByTen(numberToMultiply.i)
Global MultiplyByTen.MultiplyByTen

If OpenLibrary(0, "yourdllwithmultiplybytenfunction.dll")
  MultiplyByTen = GetFunction(0, "MultiplyByTen")
  Debug MultiplyByTen(100)
EndIf
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
boop64
User
User
Posts: 14
Joined: Tue Nov 18, 2003 12:42 pm
Contact:

Re: Unmanaged DLL

Post by boop64 »

While you are correct OpenLibrary works fine for most DLL's, some DLL's do not have an export table and are not able to be called or interrogated by the normal purebasic functions.

Thanks,

boop64
ts-soft wrote:I can't see any problem with Openlibrary:

Code: Select all

PrototypeC MultiplyByTen(numberToMultiply.i)
Global MultiplyByTen.MultiplyByTen

If OpenLibrary(0, "yourdllwithmultiplybytenfunction.dll")
  MultiplyByTen = GetFunction(0, "MultiplyByTen")
  Debug MultiplyByTen(100)
EndIf
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Unmanaged DLL

Post by ts-soft »

You can load and use all unmanaged dlls, if no function-export, use GetFunctionEntry()
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply