Page 1 of 1

Shared Librarys and String

Posted: Wed Mar 29, 2023 5:59 pm
by Ground0
Hello

I think i'm walk arround the problem and didn't find it :-(

Code: Select all

#TESTDLL = 0

CompilerIf #TESTDLL = 1

  ; Real code start here..
  ;
  Global TestReport.s
  
  ProcedureCDLL.s Testcall(Test.s)
    
    TestReport = "Test Report"
    ProcedureReturn TestReport.s

  EndProcedure

CompilerElse
  
  PrototypeC.s Test_dll(test.s)
  
  OpenLibrary(0, "PureBasic.so")
  Define.Test_dll Testtodll = GetFunction(0, "Testcall")
  Response.s = Testtodll("Das ist Original")
  NewString.s = PeekS(@Response,-1,#PB_Ascii)
  MessageRequester("Info", "As Var:"+ Response)
  MessageRequester("Info", "Direct function:" + Testtodll("Das ist Original"))
    
CompilerEndIf
I can't get the String from the DLL resp. from the .so file... what did i wrong? It's a stripped down thing... so it was easy to find the problem...

Once Compiled with #TESTDLL = 1 to a .so and executed with #TESTDLL=0 (PB 6.01LTS on Linux x64) Both ASM and C Backend :cry:

Greeting

Re: Shared Librarys and String

Posted: Wed Mar 29, 2023 6:36 pm
by HeX0R
You receive a pointer to the string, which means you have to do a PeekS(ResultFromDLLProcedure) to see the string.

Re: Shared Librarys and String

Posted: Wed Mar 29, 2023 7:09 pm
by Ground0
Thanks a lot... as i say didn't see the Problem after this "Small" Big change...

The end result is a new lweb git push with big changes :-) Now a external library can be configured :D

https://gitea.lihaso.com/PB_Includes/lweb

I hope some other find some fun with it :-)

Greeting