Skip to content

Importing modules in embedded Janet #1294

Answered by bakpakin
michaelberens asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, so I have gone over the code a bit and the issue is actually quite simple. The problem is:

target_link_libraries     (mymod PUBLIC janet)

which links to janet.lib, which is the import library for janet.exe (yes, the exe file not a DLL). Basically, the lib file is included so native modules can link directly to the standalone interpreter. The app is crashing because you are trying to load janet.exe as a DLL inside modhost.exe. Instead, you need to compile janet.c yourself and link to that from both the modhost.exe and mymod.dll.

# common dll
add_library(common SHARED ${JANET_DIST_DIR}/janet.c)
target_compile_definitions(common PUBLIC -DJANET_BUILD_TYPE=release)
target_link_options

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@bakpakin
Comment options

Answer selected by michaelberens
@bakpakin
Comment options

@michaelberens
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants