Shared Librarys and String

Just starting out? Need help? Post your questions and find answers here.
Ground0
User
User
Posts: 40
Joined: Fri Jun 09, 2006 10:20 pm
Location: Stilli, Schweiz
Contact:

Shared Librarys and String

Post 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
Sys 1 HW: Ryzen 7 3700X, 32GB RAM, RX 5700, NVME 512GiB And SATA 2TiB OS: openSUSE Tumbleweed x64
Sys 2 HW: 7 1700X, 16GB RAM, R7 360, SSD 480GiB & 1TiB OS: "
Sys 3 NB: HP envy X360, 5 2500U ,16GB RAM, NVME 256Gib OS: " zus. Win. 10 x64
User avatar
HeX0R
Addict
Addict
Posts: 979
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Shared Librarys and String

Post by HeX0R »

You receive a pointer to the string, which means you have to do a PeekS(ResultFromDLLProcedure) to see the string.
Ground0
User
User
Posts: 40
Joined: Fri Jun 09, 2006 10:20 pm
Location: Stilli, Schweiz
Contact:

Re: Shared Librarys and String

Post 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
Sys 1 HW: Ryzen 7 3700X, 32GB RAM, RX 5700, NVME 512GiB And SATA 2TiB OS: openSUSE Tumbleweed x64
Sys 2 HW: 7 1700X, 16GB RAM, R7 360, SSD 480GiB & 1TiB OS: "
Sys 3 NB: HP envy X360, 5 2500U ,16GB RAM, NVME 256Gib OS: " zus. Win. 10 x64
Post Reply