Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.extension
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.extension
Commits
d0ef4c71
Commit
d0ef4c71
authored
10 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Added function to load the C++ Library in a given bob module.
parent
82fe0d0a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/extension/__init__.py
+29
-0
29 additions, 0 deletions
bob/extension/__init__.py
with
29 additions
and
0 deletions
bob/extension/__init__.py
+
29
−
0
View file @
d0ef4c71
...
...
@@ -191,7 +191,36 @@ def get_bob_libraries(bob_packages):
return
includes
,
libraries
,
library_directories
def
load_bob_library
(
name
,
_file_
,
version
=
None
):
"""
Loads the bob Library for the given package name in the given version (if given).
The _file_ parameter is expected to be the ``__file__`` member of the main ``__init__.py`` of the package.
It is used to determine the directory, where the library should be loaded from.
Keyword parameters
name : string
The name of the bob package to load the library from, e.g. ``bob.core``
_file_ : string
The ``__file__`` member of the ``__init__.py`` file in which the library is loaded.
version : string
The version of the library to load. Can be usually omitted.
"""
libname
=
'
lib
'
+
name
.
replace
(
'
.
'
,
'
_
'
)
if
sys
.
platform
==
'
darwin
'
:
libname
+=
(
'
.
'
+
version
if
version
is
not
None
else
''
)
+
'
.dylib
'
elif
sys
.
platform
==
'
win32
'
:
libname
+=
'
.dll
'
+
(
'
.
'
+
version
if
version
is
not
None
else
''
)
else
:
# linux like
libname
+=
'
.so
'
+
(
'
.
'
+
version
if
version
is
not
None
else
''
)
full_libname
=
os
.
path
.
join
(
os
.
path
.
dirname
(
_file_
),
libname
)
import
ctypes
print
"
loading library
"
,
full_libname
ctypes
.
cdll
.
LoadLibrary
(
full_libname
)
class
Extension
(
DistutilsExtension
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment