Seite 1 von 1

DLL STDCALL in Purebasci erstellen ?

Verfasst: 16.02.2018 23:11
von funkheld
Hallo, vguten Tag.

Wie sieht bitte diese Funktion für eine DLL in Purebasic aus:
--------------------------------
FUNCTION multf STDCALL ALIAS "multf" (c AS SINGLE) AS SINGLE EXPORT
RETURN c*5
END FUNCTION
--------------------------------

Danke.
Gruss

Re: DLL STDCALL in Purebasci erstellen ?

Verfasst: 16.02.2018 23:51
von mk-soft
Ohne Worte

Code: Alles auswählen

ProcedureDLL.f multf(c.f)
  Protected result.s
  result = c * 5.0
  ProcedureReturn result
EndProcedure

Re: DLL STDCALL in Purebasci erstellen ?

Verfasst: 17.02.2018 10:04
von juergenkulow
Hallo funkheld,

eine Idee für multf.dll

Code: Alles auswählen

CompilerIf   #PB_Compiler_ExecutableFormat<>#PB_Compiler_DLL
  CompilerError "Compiler Optionen Exe-Format Shared DLL einstellen und mit Compiler Executable erstellen erstellen."
CompilerEndIf

Structure floatel : floatel.f : EndStructure
ProcedureDLL multf(*c.floatel,*result.floatel)
  *result\floatel=*c\floatel*5.0
  ; MessageRequester("Ergebnis von "+StrF(*c\floatel)+"ist:",StrF(*result\floatel))
EndProcedure
und für multfhaupt:

Code: Alles auswählen

EnableExplicit

If OpenLibrary(0, "multf.dll") Or OpenLibrary(0, "multf.so") Or OpenLibrary(0, "multf.dylib")
  Define MULTF=GetFunction(0,"multf")
  ; Debug MULTF
  Define Wert.f=1.23, Antwort.f
  CallFunctionFast(MULTF,@Wert,@Antwort)
  Debug Antwort
EndIf
; offen Test unter Linux und Mac 
Gruß

Re: DLL STDCALL in Purebasci erstellen ?

Verfasst: 18.02.2018 13:57
von funkheld
Danke für die Hilfe.

Gruss