понедељак, 16. јануар 2012.

tcc winsocket

lostgallifreyan wrote:
If you can give me a complete step by step method that works,
I can learn from it, but I doubt I can learn anything meaningful
from parts I cannot find any record of having been assembled
into a working whole.

Assuming you have the tcc-0.9.24 binary installation for windows
here is the "complete step by step method that works" to make
a DLL and an EXE that links to it:

$ tcc examples/dll.c -o dll.dll -shared
$ tiny_impdef dll.dll -o dll.def
$ tcc examples/hello_dll.c dll.def -o hello_dll.exe
or alternatively:
$ tcc examples/hello_dll.c -o hello_dll.exe -ldll -L.

Note also the "__declspec(dllexport)" with "HelloWorld" in dll.c
which tells TCC to export this function such that windows can
find it when it links the dll (dynamically) at the time when
hello_dll.exe is run.

That's it.  I don't know what else to say about DLL's as far
as TCC is concerned.  See also docs/readme.txt.

--- grischka




http://www.mail-archive.com/tinycc-devel@nongnu.org/msg02059.html

http://stackoverflow.com/questions/4069770/tiny-c-compiler-tcc-and-winsock

http://stackoverflow.com/questions/7622682/tcc-and-winsock-h



I have already read Tiny C Compiler (TCC) and winsock?, but I still can't compile sockets with TCC, because when I try

 tiny_impdef winsock.dll -o winsock.def
tiny_impdef responds:

Not a PE file: C:\WINDOWS\system32\winsock.dll
So how can I do to compile properly a program that use sockets? Any help will be appreciated

I'm guessing that you have a 64 bit machine and TCC is 32 bit. In that situation C:\WINDOWS\system32\winsock.dll is the 64 bit version of winsock. Try it this way:

tiny_impdef C:\WINDOWS\SysWOW64\winsock.dll -o winsock.def
to pick up winsock from the 32 bit system directory.

According to Tinycc-devel mailing list

you should give this a try:

tiny_impdef winsock.dll -o winsock.def
tcc yourcode.c  winsock.def -o yourcode.exe

Found wsock32.h on google code search. It included a few others that were easily found. Worked like a charm, cheers – tm1rbrt Nov 1 '10 at 16:23

tiny_impdef winsock.dll
copy winsock.def to lib/

run:

tcc -lwinsock yourcode.c -o yourcode.exe

Нема коментара:

Постави коментар