On Sat, Jun 28, 2014 at 6:44 PM, Michael Matz <[email protected]> wrote:

>
>
> On Fri, 27 Jun 2014, Markus Bergholz wrote:
>
>        Make it clear where “mexPrintf” is defined and why it is not
>>       effective.
>>
>>
>> "mexPrintf" is defined in /usr/include/octave-3.8.1/octave/mexproto.h
>> afaiu.
>>
>
> That's a declaration, not a definition.  The definition comes from some
> Octave internal library.  On linux you can build shared libraries that
> contain references to undefined symbols (like 'mexPrintf') that will then
> be resolved when loading the library (Octave itself or some library it
> depends on will define that symbol).  That's what happens for your working
> example (your helloworld.mex will actually be an ELF shared library
> containing unresolved references to mexPrintf).
>
> When you try the same for Windows you'll actually build a DLL.  When it's
> supposed to contain references to external symbols then you at least need a
> .def file that describes which library will provide that symbol later.
> You'll also need to generate a .lib file describing the symbols exported by
> your helloworld.mex (so that octave can load it).
>
> Generally for Octave the right way to create .mex files seems to be to use
> the helper program/script mkoctfile (with --mex), which presumably contains
> all the right libraries and other link parameters for each platform.  If
> Octave supports external commands on Windows at all.
>
> This all is not TCC specific, it's a problem in how you use Octaves system
> for C bindings.  You'll probably get better answers asking their developers.
>
>
>
Thanks for your long explanation!

After creating a .def file using tiny_imp M:\R2013b\bin\win64\libmex.dll I
can compile it without any error or warning on Windows

tcc.exe mexample.c libmex.def -IM:\R2013\extern\include\ -shared -o
mexample11.mexw64

and on Linux

x86_64-win32-tcc mexample.c libmex.def -I /usr/include/octave-3.8.1/octave/
-shared -o mexample10.mexw64

However, both end up with "Mex file entry point it missing".
Same for
tcc.exe mexample.c -IM:\R2013b\extern\include\ -shared
-LM:\R2013b\bin\win64\ -lmex -o mexample12.mexw64

So I don't understand the library part for Windows systems...can you say a
few more words about it?

Thanks in advanced,
Markus
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to