-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASN1 structure usage and AccessViolationException in MSVC #172
Comments
Though asn1c is far from perfect, I don't think it's the culprit this time. I have just run extensive memory checks with Valgrind on the |
I do not know if it would help, but I have some compilation warnings, maybe some of them are relevant? EDIT: I have removed the wall of text with the build log as I do not believe the warnings were relevant to the discussion. Build fails the first time but is successful the second time. |
Some other notes:
|
I have tried using of the CAM_t structure directly as per author of the other issue and strange thing is that it does not work either. When I try to use function
What may be relevant: description of how I am exporting the symbols from the DLLs: When building, I set
or like this (example from
I would have thought that if the symbols were exported/imported incorrectly, project would not pass linking. But it seems strange to me that the compiler would have some problem with the asn_DEF_CAM variable - what could be other reason for returning |
Culprit is that
in my program but it still fails - there is probably some other unitialized pointer somewhere. Now the |
Phew, I have never entered the dungeons of DLL symbols. If that is really the causing issue, then an AccessViolationException is not exactly pinpointing in that direction. At least not my first guess ;-) |
The truth is that when I try to dereference a null pointer, I get different exception: |
In the end, I would love to have Windows/MSVC as another target included in our GitHub actions executed for every commit. A few years ago I built Vanetza on Windows out of curiosity but not with MSVC. I had no use case for this, though. |
I think that with DLLs, ASN1 structures cannot be initialized the way they are now. Problem is that it is impossible to use address of |
But you built it as a static library, no? I think this could be added to the actions as you are saying. I do not know how to do that though. |
Yes, I think so, but I don't remember the details anymore. Building static libraries should work for C++/CLI as well, shouldn't it? |
Yes, static libraries work fine. As for the DLLs, there is one more problem - I had to use define CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS so that all the Vanetza functions are exported (windows does not do this automatically, everywhere would have to be the If you wanted, I can write instructions with all the steps needed to do the build under MSVC as there were few more workarounds I had to do. Dirtiest was adding a dummy member to empty unions in I think I can close this issue now as everything seems to work now (with the structures put in the Should I create another issue with adding static library build to the GitHub actions as you mentioned? |
Regarding the |
For future reference: The dummy field |
Hi all,
I've managed to compile Vanetza in a C++/CLI environment and want to use it as a DLL library under C#.
I am trying to use ASN.1 structures. It doesn't matter if I use the
cpp
wrapper classes or not.It is enough if I use this line:
and program fails with this error
I also tried
and it fails with the same error. It is apparent that it is caused by trying to free the structure. The address seems correct to me (usually something around 0x00000267B4216AD0).
Does anyone have an idea what could be causing this?
Regards,
Karel
The text was updated successfully, but these errors were encountered: