@@ -166,7 +166,11 @@ static void *load_module(const char *name, const char *featurename)
166
166
* We don't do this for Windows because Windows doesn't have an equivalent to LD_LIBRARY_PATH
167
167
* and because LoadLibraryA() will search the executable's folder, which works for the unit tests.
168
168
*/
169
+ #ifdef _AIX
170
+ ld_library_path = getenv ("LIBPATH" );
171
+ #else
169
172
ld_library_path = getenv ("LD_LIBRARY_PATH" );
173
+ #endif
170
174
if (NULL != ld_library_path && strlen (ld_library_path ) > 0 ) {
171
175
#define MAX_LIBRARY_PATHS 10
172
176
size_t token_index ;
@@ -184,8 +188,15 @@ static void *load_module(const char *name, const char *featurename)
184
188
cli_dbgmsg ("searching for %s, LD_LIBRARY_PATH: %s\n" , featurename , tokens [token_index ]);
185
189
186
190
for (i = 0 ; i < sizeof (suffixes ) / sizeof (suffixes [0 ]); i ++ ) {
187
- snprintf (modulename , sizeof (modulename ), "%s" PATHSEP "%s%s" , tokens [token_index ], name , suffixes [i ]);
188
-
191
+ #ifdef _AIX
192
+ snprintf (modulename , sizeof (modulename ),
193
+ "%s%s(%s%s.%d)" ,
194
+ name , ".a" , name , LT_MODULE_EXT , LIBCLAMAV_MAJORVER );
195
+ #else
196
+ snprintf (modulename , sizeof (modulename ),
197
+ "%s" PATHSEP "%s%s" ,
198
+ tokens [token_index ], name , suffixes [i ]);
199
+ #endif
189
200
rhandle = dlopen (modulename , RTLD_NOW );
190
201
if (NULL != rhandle ) {
191
202
cli_dbgmsg ("%s support loaded from %s\n" , featurename , modulename );
@@ -203,8 +214,15 @@ static void *load_module(const char *name, const char *featurename)
203
214
cli_dbgmsg ("searching for %s, user-searchpath: %s\n" , featurename , SEARCH_LIBDIR );
204
215
205
216
for (i = 0 ; i < sizeof (suffixes ) / sizeof (suffixes [0 ]); i ++ ) {
206
- snprintf (modulename , sizeof (modulename ), "%s" PATHSEP "%s%s" , SEARCH_LIBDIR , name , suffixes [i ]);
207
-
217
+ #ifdef _AIX
218
+ snprintf (modulename , sizeof (modulename ),
219
+ "%s%s(%s%s.%d)" ,
220
+ name ,".a" ,name ,LT_MODULE_EXT ,LIBCLAMAV_MAJORVER );
221
+ #else
222
+ snprintf (modulename , sizeof (modulename ),
223
+ "%s" PATHSEP "%s%s" ,
224
+ SEARCH_LIBDIR , name , suffixes [i ]);
225
+ #endif
208
226
rhandle = dlopen (modulename , RTLD_NOW );
209
227
if (NULL != rhandle ) {
210
228
cli_dbgmsg ("%s support loaded from %s\n" , featurename , modulename );
0 commit comments