Static linked library
-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
Static linked library
Is there anyway to create a static linked library (.a) or convert a dynamic library (.so) to static in PB x86?
Re: Static linked library
I know how to build a dynamic lib from a static lib but not the other way around, my guess is that it can be done but it's beyond my expertise.
btw you can use otool to view the libraries disassembled, for example, compile this example that's included with PB to dynamic lib.
then assuming you named it mydylib you will get mydylib.so, to view the disassembly of the library launch terminal and enter the following
otool -tv mydylib.so
so my guess is that since the library can be disassembled, with enough work one could write a program that would extract the objects and build a static lib.
btw you can use otool to view the libraries disassembled, for example, compile this example that's included with PB to dynamic lib.
Code: Select all
Structure MYSTRUCTURE
StringVariableA.s
StringVariableB.s
IntegerVariableA.i
FloatVariableA.f
EndStructure
ProcedureDLL AttachProcess(Instance)
;this is an array of the structure
Global Dim TORETURN.MYSTRUCTURE(300)
EndProcedure
ProcedureDLL MyFunction()
For x = 0 To 300
TORETURN(x)\StringVariableA = "StringA " + Str(x)
TORETURN(x)\StringVariableB = "StringB " + Str(x)
TORETURN(x)\IntegerVariableA = x
TORETURN(x)\FloatVariableA = x + 0.5
Next x
ProcedureReturn @TORETURN()
EndProcedure
otool -tv mydylib.so
so my guess is that since the library can be disassembled, with enough work one could write a program that would extract the objects and build a static lib.
