cnuernber/avclj

Shared Library example missing exported functions

Closed this issue · 2 comments

I'm trying to follow https://github.com/cnuernber/avclj#graal-native-shared-library

Steps 1 and 2 complete without error, but running cd library; ./compile.sh produces:

testencode.cpp:31:30: error: use of undeclared identifier
      'is_avclj_initialized'
  cout << "initialized? " << is_avclj_initialized(thread) << endl;
                             ^
testencode.cpp:32:3: error: use of undeclared identifier 'initialize_avclj'
  initialize_avclj(thread);
  ^
testencode.cpp:33:30: error: use of undeclared identifier
      'is_avclj_initialized'
  cout << "initialized? " << is_avclj_initialized(thread) << endl;
                             ^
testencode.cpp:34:18: error: use of undeclared identifier 'make_h264_encoder'
  long encoder = make_h264_encoder(thread, 256, 256,
                 ^
testencode.cpp:42:5: error: use of undeclared identifier 'encode_frame'
    encode_frame(thread, encoder, image, n_bytes);
    ^
testencode.cpp:44:3: error: use of undeclared identifier 'close_encoder'
  close_encoder(thread, encoder);
  ^
6 errors generated.

I checked libavclj.h which only contains:

#define __LIBAVCLJ_H

#include <graal_isolate.h>


#if defined(__cplusplus)
extern "C" {
#endif

int run_main(int paramArgc, char** paramArgv);

void vmLocatorSymbol(graal_isolatethread_t* thread);

#if defined(__cplusplus)
}
#endif
#endif

I noticed in scripts/compile-shared that the classes directory is deleted before running clojure -X:depstar, but classes remains empty after running clojure -X:depstar.

The depstar alias has :graal-compile under :aliases here, but I can't find a definition for the :graal-compile alias anywhere. Not sure if that's related, but I'm still not sure how libavclj.h is generated.

I'm happy to provide more info that might be helpful.

Thanks!

Whoops. Looks I missed:

but in addition go under 'native_test/avclj/libavclj.clj and run the code in the comment block that shows how to export functions to a graalvm library.

Nevermind.

Yep. I knew that would trip people up and perhaps there is a more straight forward way to explain that stuff.