Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCDDS-core
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
SPC
SCDDS
SCDDS-core
Commits
85680977
Commit
85680977
authored
4 years ago
by
Cristian Galperti
Browse files
Options
Downloads
Patches
Plain Diff
getalgoinfo with generic filename input
- to be refactored
parent
527beb8d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/gitinfointoso/Makefile
+2
-0
2 additions, 0 deletions
test/gitinfointoso/Makefile
test/gitinfointoso/getalgoinfo.c
+24
-7
24 additions, 7 deletions
test/gitinfointoso/getalgoinfo.c
with
26 additions
and
7 deletions
test/gitinfointoso/Makefile
0 → 100644
+
2
−
0
View file @
85680977
all
:
getalgoinfo.c
gcc getalgoinfo.c
-o
getalgoinfo
-ldl
This diff is collapsed.
Click to expand it.
test/gitinfointoso/getalgoinfo.c
+
24
−
7
View file @
85680977
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include
<stdint.h>
#include
<stdint.h>
#include
<stddef.h>
#include
<stddef.h>
#include
<string.h>
#include
<string.h>
#include
<libgen.h>
#define ALGOINFOMAXLEN 1024
#define ALGOINFOMAXLEN 1024
...
@@ -18,29 +19,45 @@ struct algoinfo {
...
@@ -18,29 +19,45 @@ struct algoinfo {
int
main
(
int
argn
,
char
*
argv
[])
int
main
(
int
argn
,
char
*
argv
[])
{
{
char
sofilename
[
1024
];
char
*
filename
;
char
localfilename
[
1024
];
char
algoinfofcnname
[
1024
];
void
*
libhnd
;
void
*
libhnd
;
void
(
*
algoinfofunc
)(
struct
algoinfo
*
);
void
(
*
algoinfofunc
)(
struct
algoinfo
*
);
struct
algoinfo
ai
;
struct
algoinfo
ai
;
if
(
argn
!=
2
)
{
libhnd
=
dlopen
(
"./SCD_rtccode_02_02.so"
,
RTLD_LAZY
|
RTLD_GLOBAL
);
printf
(
"usage %s <scd .so filename>
\n
"
,
argv
[
0
]);
exit
(
-
1
);
}
//snprintf(sofilename, strlen(basename(argv[1]))+3,"./%s", argv[1]);
libhnd
=
dlopen
(
argv
[
1
],
RTLD_LAZY
|
RTLD_GLOBAL
);
if
(
libhnd
==
NULL
)
if
(
libhnd
==
NULL
)
{
{
printf
(
"Error loading
.so
\n
"
);
f
printf
(
stderr
,
"Error loading
%s, try ldd .so to check libs
\n
"
,
argv
[
1
]
);
exit
(
0
);
exit
(
0
);
}
}
algoinfofunc
=
dlsym
(
libhnd
,
"SCD_rtccode_02_02_GetAlgoInfo"
);
filename
=
basename
(
argv
[
1
]);
snprintf
(
localfilename
,
strlen
(
filename
)
-
2
,
"%s"
,
filename
);
snprintf
(
algoinfofcnname
,
strlen
(
localfilename
)
+
13
,
"%s_GetAlgoInfo"
,
localfilename
);
algoinfofunc
=
dlsym
(
libhnd
,
algoinfofcnname
);
if
(
algoinfofunc
==
NULL
)
if
(
algoinfofunc
==
NULL
)
{
{
printf
(
"Error
loa
ding
SCD_rtccode_02_02_GetA
lgo
I
nfo
\n
"
);
f
printf
(
stderr
,
"Error
fin
ding
%s in .so
\n
"
,
a
lgo
i
nfo
fcnname
);
perror
(
NULL
);
perror
(
NULL
);
exit
(
0
);
exit
(
0
);
}
}
(
*
algoinfofunc
)(
&
ai
);
(
*
algoinfofunc
)(
&
ai
);
printf
(
"%
d, %s
\n
"
,
ai
.
len
,
ai
.
text
);
printf
(
"%
s (%d characters)
\n
"
,
ai
.
text
,
ai
.
len
);
}
}
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