Skip to content

miloth/zmx-diff-simple-dll-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zemax Diffraction DLL Example in Rust! 🦀

This can be modified or extended to include the other kinds of DLLs supported by Zemax.

The entry points for the raytrace and the parameter names are defined in the ./src/lib.rs file. The pointers coming from Zemax are cast to the struct defined in ./src/data_structures.rs.

Compilation

On Windows

The code can be compiled to a DLL using the following command:

cargo build --release

and the resulting DLL will be in the ./target/release/ folder, ready to be copied in the Zemax DLL folder.

On Linux or macOS

You need to have the following pre-requisites:

  • The mingw-w64 toolchain installed, which can be obtained from the package manager of your distribution on Linux or from homebrew on macOS, here a few examples:

    # On Ubuntu
    sudo apt install mingw-w64
    # On macOS
    brew install mingw-w64
  • The x86_64-pc-windows-gnu target installed in your Rust toolchain, which can be done using the following command:

    rustup target add x86_64-pc-windows-gnu

Then, you can compile the DLL using the following command:

cargo build --release --target=x86_64-pc-windows-gnu

and the resulting DLL will be in the ./target/x86_64-pc-windows-gnu/release/ folder, ready to be copied in the Zemax DLL folder.

Docs Generation

Simply run:

cargo doc --document-private-items --no-deps --target=x86_64-pc-windows-gnu

Add the additional --open flag to open the documentation in your default web browser.

Credits

Credits to Zemax for the examples in C and C++ that inspired this.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages