actually, I found the problem and discovered another. THe issue was that I was calling the subroutine without ()'s... I figured that out by running my own C include test... The new problem is that I can't figure out how to compile a .pas file with gpc so that it doesn't require a main method (begin end.)... gpc -c file.pas will give me a happy object file that's easily imported into c, but when file.pas has a main method, it conflicts with the one in my main c program...
I've been looking up compiler directives and command line options for the past hour and haven't found anything... -Nic
On Wed, 15 Nov 2000, Frank Heckenbach wrote:
Nic Webb wrote:
I'm using the example I saw in the GNU pascal documentation on how to link pascal with C (calling a C function from pascal). The example uses "asmname", which I know very little about.
When I compile the .pas file, I get a slew of errors saying: comma missing after identifier `Asmname' parse error before character constant
(that shows up once for every line I have asmname on...
I assume you meaan the example from the section "Importing Libraries from Other Languages" (CallCDemo etc.).
Did you use some dialect option like `--borland-pascal'? In this case, `asmname' is disabled (like all features that BP doesn't know).
If you don't use such an option, and have a recent GPC version, this shouldn't happen. Please post some sample code then...
(If you need to use `asmname' in a file otherwise compiled with `--borland-pascal', you can change the dialect temporarily with compiler options `{$gnu-pascal}' and `{$borland-pascal}' in the source. Though most of the time, you should be fine compiling without `--borland-pascal' at all, unless you use some very "dirty" BP misfeatures...)
when I add the --automake option to the gpc command line, it also tells me that it can't execute my program (no such file or directory). I can't compile without automake because for some reason gpc isn't able to find any valid units without it (omitting it gives me "module/unit interface `Gpc' could not be imported").
That's normal. Just use `--automake', and don't worry about it...
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html