jupyter-xeus / xeus-cling

Jupyter kernel for the C++ programming language
BSD 3-Clause "New" or "Revised" License
3.01k stars 294 forks source link

#pragma load(<libraryname>.dll) in Windows Subsystem for Linux #498

Open WesFrank opened 9 months ago

WesFrank commented 9 months ago

I am using xeus-cling on Windows Subsystem for Linux, which is currently the most popular/best known alternative to the no-windows-support-related "problem".

I often use the magic %%file to write .cpp scripts to a Windows directory as follows ...

%%file /mnt/c/Users//path/to/project/.cpp / cpp code here /

I sometimes compile files using the following syntax in a code cell ...

! powershell.exe g++ C:\Users\\path\to\project\.cpp -o C:\Users\\path\to\project\.exe

It is also possible for me to create .dll and .dir files using a similar command as the above with the -shared flag.

The problem that I experience is to import .dll and .dir using the #pragma directive like so ...

pragma cling add_include_path("/mnt/c/Users//path/to/project/") // no error

pragma cling add_library_path("/mnt/c/Users//path/to/project/") // no error

I have also tried it like this ...

pragma cling add_include_path("C:\Users\\path\to\project\") // no error

pragma cling add_library_path("C:\Users\\path\to\project\") // no error

which does not really seem what's causing the problem.

However, running the below in a code cell ...

pragma cling load(".dll")

gives this error ...

input_line_147:1:29: error: expected .dll to be a library, but it is not. If this is a source file, use #include "<libraryname>.dll"

pragma cling load(".dll")

                                                            ^ (This little up-arrow should be pointing to the closing parenthesis)

Interpreter Error:

Is there a fix for this or does anyone have an idea of how to work around this, or will this just be classified as a no-windows-support-related error?