DLL function with examples form delphi and VB

BlitzMax Forums/BlitzMax Beginners Area/DLL function with examples form delphi and VB

Snader(Posted 2005) [#1]
Hi!

Suddenly I am in the need of BlitzMax.. I have BM for a while now and for a project I need to call some DLL. The only examples I've got are these

Example in Delphi:
Function BerekenTotaalXML (InFile : Pointer; OutFile : Pointer): WordBool; Stdcall;

Example in VB:
Private Declare Function BerekenTotaalXML Lib "WUREKINT.DLL" (ByVal inFile As String, ByVal outFile As String) As WordBool

InFile = XML input
OutFile = XML output

I've been trying for 2 days now with some examples in the forum but I can't get anything out of this DLL...

Any ideas? My attempt so far...

Global infile:String = "infile.xml"

Global outfile:String="outfile.xml"

Const DllName:String = "WURekInt.dll"
Local DllHandle = LoadLibraryA(DllName)

If DLLhandle = 0 Then
    Notify "Unable to initialize the dll"
    End
EndIf


Global BerekenTotaalXML(infile:String, outfile:String) "win32"


If DllHandle 

    ' Assign DLL function "DoStuff" to "InitGame" function...

    BerekenTotaalXML= GetProcAddress (DllHandle, "BerekenTotaalXML")
    If BerekenTotaalXML= Null Then Notify "Doh!"; End

    ' More...

EndIf

Print BerekenTotaalXML(infile, outfile)



Chris C(Posted 2005) [#2]
BerekenTotaalXML(infile:String, outfile:String) "win32"= GetProcAddress (DllHandle, "BerekenTotaalXML")
should be okay....


Snader(Posted 2005) [#3]
Well, some progress...
' Declare functions (will point to DLL functions)...
Global outstring:String

Const DllName:String = "WURekInt.dll"
Local DllHandle = LoadLibraryA(DllName)

If DLLhandle = 0 Then
    Notify "Unable to initialize the dll"
    End
EndIf

'Global BerekenTotaal$z(instring:String, outstring:String)"Win32" = GetProcAddress(DllHandle,"BerekenTotaalXML")

Global BerekenTotaal:Long(instring:String, outstring:String)"Win32" = GetProcAddress(DllHandle,"BerekenTotaalXML")

Print BerekenTotaal("infile.xml", "test.xml")


But in Delphi they say in the example the functions returns a WordBool type. what is the equivalent in BlitzMax?


Chris C(Posted 2005) [#4]
i'm guessing that a wordbool is a boolean value stored in a word? try int??
which is a little odd doesnt Totaal mean total? whats Bereken?


LarsG(Posted 2005) [#5]
I think it's calculate in Dutch or something... (so it's CalculateTotal())


Snader(Posted 2005) [#6]
Yep, it's dutch. But that shouldn't matter...