dracula004 wrote:The source was already attached in former post.
I'm trying to build that dll with vs.
I downloaded the source before (and just now) and there are no c or c++ files in there. Can you post the C/C++ source (not just lua) The .dll file is not really any help.
I feel pretty stupid now.... Ok it is really late where I live so I can't do anything tonight but after a quick glance your code looks fine but because LOVE uses luaJIT (assuming you are using LOVE version 0.9.x) not just plain lua make sure you are using the luaJIT c headers instead of lua ones. The names of the files are exactly the same because luaJIT strives to be a drop in replacement but you need to make you you compile you code for luaJIT not lua because it will crash if you try otherwise. If are using the right headers I will look at this tomarrow... (For you debug function it might be useful to note that luaJIT adds a new lua type the "ctype".)
I have done this before so I should be able to help you to get this running. Sure it was linux I got it working on because that is my OS of choice but I can boot the dusty windows partition of my comp.
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Your code works just fine in linux LOVE. I haven't tried windows yet. Are you making sure that the library architecture (ie. 32bit/64bit) is the same as the LOVE executable that is loading your program?
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
I~=Spam wrote:I feel pretty stupid now.... Ok it is really late where I live so I can't do anything tonight but after a quick glance your code looks fine but because LOVE uses luaJIT (assuming you are using LOVE version 0.9.x) not just plain lua make sure you are using the luaJIT c headers instead of lua ones. The names of the files are exactly the same because luaJIT strives to be a drop in replacement but you need to make you you compile you code for luaJIT not lua because it will crash if you try otherwise. If are using the right headers I will look at this tomarrow... (For you debug function it might be useful to note that luaJIT adds a new lua type the "ctype".)
I have done this before so I should be able to help you to get this running. Sure it was linux I got it working on because that is my OS of choice but I can boot the dusty windows partition of my comp.
Maybe luaJIT is the point. I built the lib with plain lua. I'll have a try with luaJIT. And thx much.
The "-llua" means I was just linking against plain lua (if I understand correctly). But this is linux so the build process might be different or more flexible somehow.
Have you checked that are are not compiling a 32bit lib when you should be compiling a 64bit lib? I recommend you download the 64bit and 32bit versions of LOVE and try it out with each. If the library doesn't match and lua tries to call code from your lib it is almost certain that it will crash. (unless lua is nice enough to detect a mismatch which I doubt because that probably won't follow the ANSI C standard which lua has gone to incredible lengths to follow.)
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Ahh didn't think of that! That might be it. So linking directly against lua 5.1 or luajit should work (and make sure you binary architectures match )
If you are getting sick of waiting you could just download the LOVE source and just add your own module and functions directly for there. That is what I would do unless I wanted others to be able to use my .love file.
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
The "-llua" means I was just linking against plain lua (if I understand correctly). But this is linux so the build process might be different or more flexible somehow.
Have you checked that are are not compiling a 32bit lib when you should be compiling a 64bit lib? I recommend you download the 64bit and 32bit versions of LOVE and try it out with each. If the library doesn't match and lua tries to call code from your lib it is almost certain that it will crash. (unless lua is nice enough to detect a mismatch which I doubt because that probably won't follow the ANSI C standard which lua has gone to incredible lengths to follow.)
But obviously, it is not about 32/64 bit. I used 32 bit both in LUA and LOVE.
It's just kinda weird.
I know that there must be something wrong, but i just can not find where goes wrong.