✅ Help with using C++ library in C# code
hello, I am trying to use a c++ library using a .dylib (mac dll) and its giving me a weird error that i can't find a lot of info on, maybe because its unique to osx?
as u can see I tried setting the environment variable to the asan dylib but it didn't work. Idk why asan is coming up at all, I compiled the dylib without address sanitization. The error only occurs when I try to call this function:
ive never tried to use c++ with c# before, so im very new to this. Any insight is appreicated! The dylib is in the correct folder, as it complained about that before and I moved it
10 Replies
Are the functions in the header in an external C block?
I don't know much about this topic but don't use you
export to set an environment variable?honestly idk much about environment variables
[LibraryImport("libSpaceGame.dylib")] also tried this and it gave the same error
just to test, I am compiling this:
sorry i dk if that answers ur questionIs that a .c or .cpp file? But also I don’t see the necessary stuff to export the function.
.cpp
oh i need to export it in cpp
how would I do that do you have a resource? im not finding what I need
$cpp
We're partnered with Together C & C++, check them out here: https://discord.gg/tccpp
oh lol fair
https://medium.com/@tintinwinata/bridging-worlds-a-practical-guide-to-c-and-c-integration-2ef6989f6ede gonna read this ty for the direction
Medium
Bridging Worlds: A Practical Guide to C++ and C# Integration
In the world of software development, choosing the right tool for the job is paramount. C# and the .NET ecosystem offer incredible…
ok it worked with the proper c++
thanks!
just for good answer practice I used this code
on mac