Page 1 of 1

Unmanaged DLL

Posted: Thu Mar 08, 2012 3:02 am
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

Re: Unmanaged DLL

Posted: Thu Mar 08, 2012 3:21 am
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

Re: Unmanaged DLL

Posted: Thu Mar 08, 2012 3:29 am
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

Re: Unmanaged DLL

Posted: Thu Mar 08, 2012 3:33 am
by ts-soft
You can load and use all unmanaged dlls, if no function-export, use GetFunctionEntry()