News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

TinyPTC -> MASM32 (Linking problems)

Started by LithiumDex, January 17, 2007, 01:06:30 AM

Previous topic - Next topic

LithiumDex

I'm attempting to create a (conceptual) system for using TinyPTC with MASM32..
Those who aren't fermilure with TinyPTC and how it works, it's basically a simple graphics library, which gives you the ability to create a window/go into full screen and write a buffer too that surface. There are only three functions, and the options (i.e. fullscreen vs windowed) are set with macros in the tinyptc.h file, and the options are "hardcoded" in when it is compiled.

Now, the windows version comes with uncompiled C source, and ASM (NASM) source, with a VC 6.0 project workspace file...

So anyway, what I'm trying to do is this:
- Compile the source in VC 2003 (works)
- Take the object files (exluding the demo or main module) and use masm32\bin\lib.exe to make them into a library
- Create a simple header file and example program with MASM32

I'm learning a lot of this as I go along, but it's getting there -- I have all 3 of the above "done", i'm just having this problem:

Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: D:\asmcast\asmcast.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

asmcast.obj : error LNK2001: unresolved external symbol _ptc_open@12
asmcast.obj : error LNK2001: unresolved external symbol _ptc_update@4
asmcast.obj : error LNK2001: unresolved external symbol _ptc_close@0
asmcast.exe : fatal error LNK1120: 3 unresolved externals
_
Link error


I don't really understand why, given the set of macro settings for this build, and the fact that the demo works, the functions are definatley there... The only thing I can think of is that maybe VC 2003 has some weird way of naming functions it compiles. But anyway, I've uploaded both sources: http://lithium.zext.net/Tiny-PTC.rar (converted to 2003 source), and my MASM32 test: http://lithium.zext.net/asmcast.rar

Any help would be greatly appretiated.

hutch--

Two things, make sure you have prototyped the functions correctly and make sure the functions are available in the library or source code. Usually an unresolved external problem breaks down to one of these.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

LithiumDex

fixed those by adding _stdcall too the prototypes in the c source, but now I'm getting:
LINK : fatal error LNK1104: cannot open file "uuid.lib"

uuid.lib is in masm32\lib -- what does this mean?

LithiumDex



woo!

I had link them as obj files... which isn't quite what I wanted, a .lib would mean I could build it from the qeditor... That's allright though -- My only other quarrel is the size of the executable... It's f'ing huge for tinyPTC and asm.. I'm wondering if that's because it uses DirectX?

Anyway, thanks for your help hutch, I think I'm going to write a raycasting engine.

http://lithium.zext.net/asmcast.rar (working demo as seen above)

Tedd

The large size probably comes from the fact that you're linking the obj, which basically means you have your program with the whole ptc library stuck to it (whether or not you even use half of it.)
If you can manage to build TinyPTC as a set of lib files (might take a bit more work), then only the functions you use/need will be included, so the size should come down a lot.
No snowflake in an avalanche feels responsible.

LithiumDex

right... I think I could get it to work, but I do remeber having to pull "oldnames.lib" out of my msvs\lib folder for it too compile, maybe that's not such a big deal.

EDIT: Also I'm hoping that it doesn't have .net dependanceys... is so maybe I should get myself a copy of VC 6

EDIT: TinyPtc obj files -> 16kb, VC 8 demo exe size -> ~20kb, my executable -> 300kb :/

LithiumDex

It was just because I had defined the frame buffer in exe space, using malloc put the exe size down to 6kb. Works using a lib now, and I modified the original to include a deinit "callback", so you can free up any memory before TinyPTC calls ExitProcess.

If anyone wants to use this I can clean it up and upload it, just post.