Not sure I can be of any help if the examples and the documents are not sufficient. You can’t just put a function in a DLL and hope GAMS works with it, You have to follow a strict API to make the function visible to GAMS. The trilib examples (https://www.gams.com/24.9/testlib_ml/libhtml/testlib_trilib01.html) show this for a couple of languages with very simple function (sin/cos), so you can concentrate on the mechanics.
I saw the code and even your codes. I should confess GAMS is the most complicated programming languages I have ever seen! Unfortunately, it’s like decoding… even the guides don’t provide any clear explanation. I don’t know why.
When I google GAMS tutorial or sources, nothing’s found. It’s really bizarre such a great software …