Loading julia shared library in C on Windows


I am trying to load the julia shared library in C on Windows using the following C code. And the returned pointer is NULL no matter what I tried.

#include <Windows.h>
#include <stdio.h>

int main() {
	int status = 0;
    HINSTANCE plib;
    plib =  LoadLibrary("C:\\Users\\IEUser\\AppData\\Local\\JULIA-~1.1\\bin\\julia.exe");
	printf("%p\n", (void*) plib);
    return 0;

I am sure that julia.exe can be opened as I could use ctypes.CDLL to open it in python.

In [1]: import ctypes

In [2]: ctypes.CDLL("C:\\Users\\IEUser\\AppData\\Local\\JULIA-~1.1\\bin\\julia.exe")
Out[2]: <CDLL 'C:\Users\IEUser\AppData\Local\JULIA-~1.1\bin\julia.exe', handle 400000 at 0x1baf6170630>

Does anyone have any experiences on this matter?


Is there a specific reason you are trying to load the exe? You can’t do that without some hacks. Use libjulia[.dll], as documented in the embedding section of the manual and demonstrated in the embedding test (which shows usage from C).