{"action":"created","issue":{"url":"https://api.github.com/repos/mono/CppSharp/issues/641","repository_url":"https://api.github.com/repos/mono/CppSharp","labels_url":"https://api.github.com/repos/mono/CppSharp/issues/641/labels{/name}","comments_url":"https://api.github.com/repos/mono/CppSharp/issues/641/comments","events_url":"https://api.github.com/repos/mono/CppSharp/issues/641/events","html_url":"https://github.com/mono/CppSharp/issues/641","id":146905651,"number":641,"title":"Can't control name mangling","user":{"login":"TechnikEmpire","id":11234763,"avatar_url":"https://avatars.githubusercontent.com/u/11234763?v=3","gravatar_id":"","url":"https://api.github.com/users/TechnikEmpire","html_url":"https://github.com/TechnikEmpire","followers_url":"https://api.github.com/users/TechnikEmpire/followers","following_url":"https://api.github.com/users/TechnikEmpire/following{/other_user}","gists_url":"https://api.github.com/users/TechnikEmpire/gists{/gist_id}","starred_url":"https://api.github.com/users/TechnikEmpire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TechnikEmpire/subscriptions","organizations_url":"https://api.github.com/users/TechnikEmpire/orgs","repos_url":"https://api.github.com/users/TechnikEmpire/repos","events_url":"https://api.github.com/users/TechnikEmpire/events{/privacy}","received_events_url":"https://api.github.com/users/TechnikEmpire/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-04-08T11:43:49Z","updated_at":"2016-04-08T15:59:48Z","closed_at":null,"body":"Forgive me if I've missed this in the docs somewhere.\r\n\r\nI'm trying to control the name mangling on extern function definitions. I'm trying to generate pinvoke code for part of the Win API. I tried:\r\n```\r\npublic void Setup(Driver driver)\r\n{ \r\n    var options = driver.Options;\r\n    options.LanguageVersion = CppSharp.Parser.LanguageVersion.C;\r\n}\r\n```\r\nBut this instead just causes a crash with:\r\n\r\n```\r\nerror: invalid argument '-std=gnu99' not allowed with 'C++/ObjC++'\r\nUnhandled type class 'FunctionNoProto'\r\n\r\nUnhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.\r\n   at CppSharp.CppParser.ClangParser.ParseHeader(ParserOptions* )\r\n   at CppSharp.Parser.ClangParser.ParseHeader(ParserOptions Opts) in c:\\projects\\cppsharp\\src\\cppparser\\bindings\\cli\\cppparser.cpp:line 531\r\n   at CppSharp.ClangParser.ParseSourceFile(SourceFile file) in C:\\projects\\cppsharp\\src\\Core\\Parser\\Parser.cs:line 59\r\n   at CppSharp.ClangParser.<ParseProject>b__10_0(SourceFile s) in C:\\projects\\cppsharp\\src\\Core\\Parser\\Parser.cs:line 73\r\n   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()\r\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at CppSharp.ClangParser.ParseProject(Project project) in C:\\projects\\cppsharp\\src\\Core\\Parser\\Parser.cs:line 73\r\n   at CppSharp.Driver.ParseCode() in C:\\projects\\cppsharp\\src\\Generator\\Driver.cs:line 205\r\n   at CppSharp.ConsoleDriver.Run(ILibrary library) in C:\\projects\\cppsharp\\src\\Generator\\Driver.cs:line 475\r\n```\r\n\r\nI'm assuming I am handling this incorrectly. The libraries I'm trying to generate code for only have exported C functions (obviously no mangling) but no matter what I do, or what I override using my own `TranslationUnitPass`, I cannot modify this successfully. I always get mangled names in the `DllImportAttribute::EntryPoint` member. So I guess this is two questions: \r\n\r\n1) Is this the correct way to do this, making this a bug?\r\n2) Where/how can I override generation of attributes such as `DllImportAttribute`?\r\n\r\nThanks in advance and thanks for publishing this tool its brilliant."},"comment":{"url":"https://api.github.com/repos/mono/CppSharp/issues/comments/207493093","html_url":"https://github.com/mono/CppSharp/issues/641#issuecomment-207493093","issue_url":"https://api.github.com/repos/mono/CppSharp/issues/641","id":207493093,"user":{"login":"tritao","id":602268,"avatar_url":"https://avatars.githubusercontent.com/u/602268?v=3","gravatar_id":"","url":"https://api.github.com/users/tritao","html_url":"https://github.com/tritao","followers_url":"https://api.github.com/users/tritao/followers","following_url":"https://api.github.com/users/tritao/following{/other_user}","gists_url":"https://api.github.com/users/tritao/gists{/gist_id}","starred_url":"https://api.github.com/users/tritao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tritao/subscriptions","organizations_url":"https://api.github.com/users/tritao/orgs","repos_url":"https://api.github.com/users/tritao/repos","events_url":"https://api.github.com/users/tritao/events{/privacy}","received_events_url":"https://api.github.com/users/tritao/received_events","type":"User","site_admin":false},"created_at":"2016-04-08T15:59:48Z","updated_at":"2016-04-08T15:59:48Z","body":"That only fixes the first issue though, looks like there's another one dealing with FunctionNoProto types, which will also need a fix."}}