It is currently Wed Oct 28, 2020 8:53 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: DLL: AttachProcess() will not be called
PostPosted: Sat Apr 02, 2016 5:56 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 427
Location: Germany
DLL:
Code:
Global Text.s = "Nothing was called!"

ProcedureDLL AttachProcess(Instance) ; ProcedureCDLL doesn't work, too.
  Text = "AttachProcess was called!"
EndProcedure

ProcedureDLL.s GetText()
  ProcedureReturn Text
EndProcedure

Program:
Code:
If OpenLibrary(0, "/tmp/bla.so")
  Debug PeekS(CallFunction(0, "GetText"))
  CloseLibrary(0)
EndIf

Fred wrote:
AttachProcess() should be called on linux as well, if not it's a bug.
Source: viewtopic.php?p=485833#p485833

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
 Post subject: Re: DLL: AttachProcess() will not be called
PostPosted: Wed Feb 21, 2018 11:43 pm 
Offline
User
User

Joined: Sat Jan 20, 2018 5:28 pm
Posts: 29
Location: Germany
if you do it like this, it works:
Code:
Global Text.s

ProcedureDLL AttachProcess(Instance)
  Text = "AttachProcess was called!"
EndProcedure

ProcedureDLL.s GetText()
  ProcedureReturn Text
EndProcedure


OS:
Code:
Kernel       : Linux 4.13.0-21-generic (x86_64)
Version      : #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017
C-Library    : GNU C Library / (Ubuntu GLIBC 2.26-0ubuntu2) 2.26
Distribution : Ubuntu 17.10
Computername : Lubuntu


Top
 Profile  
Reply with quote  
 Post subject: Re: DLL: AttachProcess() will not be called
PostPosted: Thu Feb 22, 2018 6:37 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2683
Location: Germany
Is different to windows...

At windows, the PB-compiler call first the procedures and AttachProzess
Code:
EnableExplicit

DeclareModule Common
  Global Text.s
EndDeclareModule

Module Common
 
  ; Do this always inside Procedure for DLL's
  Procedure InitModule()
    Text + "Init... "
  EndProcedure : InitModule()
 
EndModule

UseModule Common

ProcedureDLL AttachProcess(Instance) ; ProcedureCDLL doesn't work, too.
  Text + "AttachProcess was called!... "
EndProcedure

ProcedureDLL.s GetText()
  ProcedureReturn Text
EndProcedure

CompilerIf #PB_Compiler_Debugger
  If OpenLibrary(0, "bla.so")
    Debug PeekS(CallFunction(0, "GetText"))
    CloseLibrary(0)
  EndIf
CompilerEndIf

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye