Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Utils
KWSys
Commits
5f63e0d5
Commit
5f63e0d5
authored
19 years ago
by
Mathieu Malaterre
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Still more coverage of the DynamicLoader
parent
9e2bc9c6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
testDynamicLoader.cxx
+18
-2
18 additions, 2 deletions
testDynamicLoader.cxx
with
19 additions
and
2 deletions
CMakeLists.txt
+
1
−
0
View file @
5f63e0d5
...
...
@@ -515,6 +515,7 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
# If kwsys contains the DynamicLoader, need extra library
IF
(
KWSYS_USE_DynamicLoader
)
ADD_LIBRARY
(
testDynload SHARED testDynload.c
)
IF
(
UNIX
)
TARGET_LINK_LIBRARIES
(
${
KWSYS_NAMESPACE
}
dl
)
ENDIF
(
UNIX
)
...
...
This diff is collapsed.
Click to expand it.
testDynamicLoader.cxx
+
18
−
2
View file @
5f63e0d5
...
...
@@ -25,7 +25,18 @@
#include
"testSystemTools.h"
/* libname = Library name
kwsys_stl
::
string
GetLibName
(
const
char
*
lname
)
{
// Construct proper name of lib
kwsys_stl
::
string
slname
;
slname
=
kwsys
::
DynamicLoader
::
LibPrefix
();
slname
+=
lname
;
slname
+=
kwsys
::
DynamicLoader
::
LibExtension
();
return
slname
;
}
/* libname = Library name (proper prefix, proper extension)
* System = symbol to lookup in libname
* r1: should OpenLibrary succeed ?
* r2: should GetSymbolAddress succeed ?
...
...
@@ -62,7 +73,7 @@ int main(int , char *[])
{
int
res
;
// Make sure that inexistant lib is giving correct result
res
=
TestDynamicLoader
(
"
foobar.lib
"
,
"foobar"
,
0
,
0
,
0
);
res
=
TestDynamicLoader
(
"
azerty_
"
,
"foo
_
bar"
,
0
,
0
,
0
);
// Make sure that random binary file cannnot be assimilated as dylib
res
+=
TestDynamicLoader
(
TEST_SYSTEMTOOLS_BIN_FILE
,
"wp"
,
0
,
0
,
0
);
#ifdef __linux__
...
...
@@ -71,6 +82,11 @@ int main(int , char *[])
res
+=
TestDynamicLoader
(
"libdl.so"
,
"dlopen"
,
1
,
1
,
1
);
res
+=
TestDynamicLoader
(
"libdl.so"
,
"TestDynamicLoader"
,
1
,
0
,
1
);
#endif
// Now try on the generated library
kwsys_stl
::
string
libname
=
GetLibName
(
"testDynload"
);
res
+=
TestDynamicLoader
(
libname
.
c_str
(),
"dummy"
,
1
,
0
,
1
);
res
+=
TestDynamicLoader
(
libname
.
c_str
(),
"TestDynamicLoaderFunction"
,
1
,
1
,
1
);
res
+=
TestDynamicLoader
(
libname
.
c_str
(),
"TestDynamicLoaderData"
,
1
,
1
,
1
);
return
res
;
}
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