[HELP] Passing text into DLL

Everything else that doesn't fall into one of the other PB categories.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Num3.

Can anyone gimme a help on this one?

;DLL Procedure

ProcedureDLL settext(a.s)

ProcedureReturn a+" OK"

EndProcedure

;Function Call


If OpenLibrary(0,"add.dll")

*a.s="Zé"

MessageRequester("Result",Str(CallFunction(0,"setstext",*a)),0)

EndIf

Result is alway "0"



--
Kind Regards
Rui Carvalho

Old programmers never die... They branch into a subroutine...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.

Name of function:

settext(a.s)

setstext

is diferent.

Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Num3.

I've seen it was from retyping....

The function name is correct, just misspelled here :)

You see a DLL only accepts pointers in, but i can't seem to get the text out of the pointer it returns inside the DLL :cry:

Here's another example:

;DLL CODE

ProcedureDLL add(a,b)

ProcedureReturn (a+b)

EndProcedure

ProcedureDLL settext(a.s)


ProcedureReturn a+"OK"

EndProcedure


; Function Calling

If OpenLibrary(0,"add.dll")

*a.s="Peter Pan"
MessageRequester("Result",Str(CallFunction(0,"add",5,6)),0)
;Result is eleven

MessageRequester("Result",Str(CallFunction(0,"settext",*a)),0)
;Result is 1 ???

EndIf

--
Kind Regards
Rui Carvalho

Old programmers never die... They branch into a subroutine...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by VPureBasic.

Hi Num3.,
Originally posted by Num3

I've seen it was from retyping....

The function name is correct, just misspelled here :)

You see a DLL only accepts pointers in, but i can't seem to get the text out of the pointer it returns inside the DLL :cry:

Here's another example:

;DLL CODE

ProcedureDLL add(a,b)

ProcedureReturn (a+b)

EndProcedure

ProcedureDLL settext(a.s)


ProcedureReturn a+"OK"

EndProcedure


; Function Calling

If OpenLibrary(0,"add.dll")

*a.s="Peter Pan"
MessageRequester("Result",Str(CallFunction(0,"add",5,6)),0)
;Result is eleven

MessageRequester("Result",Str(CallFunction(0,"settext",*a)),0)
;Result is 1 ???

EndIf

--
Kind Regards
Rui Carvalho

Old programmers never die... They branch into a subroutine...
First set your procedure to "PROCEDUREDLL.s"
Second Read the return loke this:

Sentence.s = PeekS( CallFunction( 0, "settext","This example works.." )

Roger
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Num3.

Sh*t .... of course!!!!

That's another undocumented feature... Didn't know abou PROCEDUREDLL.s

:)

--
Kind Regards
Rui Carvalho

Old programmers never die... They branch into a subroutine...
Post Reply